|
|
using Estsh.Core.Controllers;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using System.Collections;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:盘点单管理
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class CycleCountManageController : BaseController
|
|
|
{
|
|
|
private ICycleCountManageService service;
|
|
|
public CycleCountManageController(ICycleCountManageService _service)
|
|
|
{
|
|
|
service = _service;
|
|
|
}
|
|
|
//
|
|
|
// GET: /Menu/
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult CheckStockDetailIndex(string orderNo)
|
|
|
{
|
|
|
ViewData.Add("orderNo", orderNo);
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 盘点单
|
|
|
/// </summary>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getCheckStockByPage(string orderNo, string orderType, string orderStatus, string startTime, string endTime, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getCheckStockByPage(orderNo, orderType, orderStatus, startTime, endTime, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 盘点单明细
|
|
|
/// </summary>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getCheckStockListByPage(string orderNo, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<WmsCheckStockList> dataHt = this.service.getCheckStockListByPage(orderNo, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//搜索盘点单明细
|
|
|
public ActionResult getSearchCheckStockList(string orderNo, string partNo, string partSpec, string cartonNo)
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<WmsCheckStockList> dataHt = this.service.getSearchCheckStockList(orderNo, partNo, partSpec, cartonNo);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 盘点单零件
|
|
|
/// </summary>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getCheckStockPartByPage(string orderNo, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<WmsCheckStockPart> dataHt = this.service.getCheckStockPartByPage(orderNo, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 盘点单存储区
|
|
|
/// </summary>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getCheckStockZoneByPage(string orderNo, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<WmsCheckStockZone> dataHt = this.service.getCheckStockZoneByPage(orderNo, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 盘点单库位
|
|
|
/// </summary>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getCheckStockLocateByPage(string orderNo, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<WmsCheckStockLocate> dataHt = this.service.getCheckStockLocateByPage(orderNo, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 盘点单范围
|
|
|
/// </summary>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getCheckStockRangeByPage(string orderNo, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<WmsCheckStockRange> dataHt = this.service.getCheckStockRangeByPage(orderNo, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult getSelectMoveOrderType()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.GetMoveOrderType(factoryId);
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取父节点菜单下拉列表数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getSelectFactory()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.getSelectFactory();
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult getSelectWarehouse()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.getSelectWarehouse(factoryId);
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult getMultiErpwarehouse()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<MultiKeyValueResult> menuList = this.service.GetMultiErpwarehouse(factoryId);
|
|
|
result.Add("treeNodes", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult getMultiPartNo()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<MultiKeyValueResult> menuList = this.service.GetMultiPartNo(factoryId);
|
|
|
result.Add("treeNodes", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult getMultiWarehouse()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<MultiKeyValueResult> menuList = this.service.GetMultiWarehouse(factoryId);
|
|
|
result.Add("treeNodes", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult getMultiZone()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<MultiKeyValueResult> menuList = this.service.GetMultiZone(factoryId);
|
|
|
result.Add("treeNodes", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult getMultiLocate()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<MultiKeyValueResult> menuList = this.service.GetMultiLocate(factoryId);
|
|
|
result.Add("treeNodes", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult getSelectZone()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.getSelectZone(factoryId);
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult getSelectVendor()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.getSelectVendor(factoryId);
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult GetPart()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.GetPart(factoryId);
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult GetPartByPage(string partNo, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.GetPartByPage(partNo, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult GetZoneByPage(string warehouseId, string erpWarehouse, string zoneName, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
string erpWarehouseVal = "";
|
|
|
|
|
|
if (!string.IsNullOrEmpty(erpWarehouse))
|
|
|
{
|
|
|
List<string> erpWarehouseList = erpWarehouse.Split(",").ToList();
|
|
|
for (int i = 0; i < erpWarehouseList.Count; i++)
|
|
|
{
|
|
|
erpWarehouseVal += "'" + erpWarehouseList[i] + "',";
|
|
|
}
|
|
|
erpWarehouseVal = erpWarehouseVal.Substring(0, erpWarehouseVal.Length - 1);
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(warehouseId))
|
|
|
{
|
|
|
if (warehouseId.Contains(","))
|
|
|
{
|
|
|
warehouseId = warehouseId.Substring(0, warehouseId.Length - 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.GetZoneByPage(zoneName, warehouseId, erpWarehouseVal, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult GetLocateByPage(string locateName, string warehouseId, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(warehouseId))
|
|
|
{
|
|
|
if (warehouseId.Contains(","))
|
|
|
{
|
|
|
warehouseId = warehouseId.Substring(0, warehouseId.Length - 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.GetLocateByPage(locateName, warehouseId, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult GetCheckStockType()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.GetCheckStockType(factoryId);
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
//单据类型
|
|
|
public ActionResult GetCheckStockStatus()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.GetCheckStockStatus(factoryId);
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
|
|
|
public ActionResult EditCycleCountManage()
|
|
|
{
|
|
|
return View("EditCycleCountManage");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存菜单数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult saveCycleCountManage()
|
|
|
{
|
|
|
|
|
|
String editType = Request.Form["editType"].ToString();
|
|
|
|
|
|
String orderType = Request.Form["orderType"].ToString();
|
|
|
String isObvious = Request.Form["isObvious"].ToString();
|
|
|
|
|
|
String warehouseId = Request.Form["warehouseId"].ToString();
|
|
|
String erpWarehouse = Request.Form["erpWarehouse"].ToString();
|
|
|
|
|
|
|
|
|
String partNoDetailRow = Request.Form["partNoDetailRow"].ToString();
|
|
|
String zoneNameDetailRow = Request.Form["zoneNameDetailRow"].ToString();
|
|
|
String locateNameDetailRow = Request.Form["locateNameDetailRow"].ToString();
|
|
|
|
|
|
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
String factoryCode = CurrentEmp.FactoryCode;
|
|
|
//String enabled = Request.Form["enabled"].ToString();
|
|
|
|
|
|
//String detailRow = Request.Form["detailRow"].ToString();
|
|
|
//List<string> erpList = erphouse.Split(',').ToList();
|
|
|
|
|
|
IList<SysPart> partNoDetailRowList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SysPart>>(partNoDetailRow);
|
|
|
|
|
|
IList<SysZone> zoneNameDetailRowList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SysZone>>(zoneNameDetailRow);
|
|
|
|
|
|
IList<SysLocate> locateNameDetailRowList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SysLocate>>(locateNameDetailRow);
|
|
|
|
|
|
string partNo = "";
|
|
|
for (int i = 0; i < partNoDetailRowList.Count; i++)
|
|
|
{
|
|
|
partNo += partNoDetailRowList[i].PartNo + ",";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(partNo))
|
|
|
{
|
|
|
partNo = partNo.Substring(0, partNo.Length - 1);
|
|
|
}
|
|
|
|
|
|
WmsCheckStock checkStock = new WmsCheckStock();
|
|
|
checkStock.OrderType = orderType;
|
|
|
checkStock.PartNo = partNo;
|
|
|
checkStock.ErpWarehouse = erpWarehouse;
|
|
|
checkStock.IsObvious = string.IsNullOrEmpty(isObvious) ? 0 : Convert.ToInt32(isObvious);
|
|
|
checkStock.FactoryId = factoryId;
|
|
|
checkStock.FactoryCode = factoryCode;
|
|
|
|
|
|
//List<string> partNoList = partNo.Split(',').ToList();
|
|
|
List<WmsCheckStockPart> checkStockPartList = new List<WmsCheckStockPart>();
|
|
|
for (int i = 0; i < partNoDetailRowList.Count; i++)
|
|
|
{
|
|
|
WmsCheckStockPart checkStockPart = new WmsCheckStockPart();
|
|
|
checkStockPart.PartId = partNoDetailRowList[i].PartId;
|
|
|
checkStockPart.PartNo = partNoDetailRowList[i].PartNo;
|
|
|
checkStockPart.PartSpec = partNoDetailRowList[i].PartSpec;
|
|
|
checkStockPart.FactoryId = factoryId;
|
|
|
checkStockPart.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockPartList.Add(checkStockPart);
|
|
|
}
|
|
|
|
|
|
List<WmsCheckStockZone> checkStockZoneList = new List<WmsCheckStockZone>();
|
|
|
for (int i = 0; i < zoneNameDetailRowList.Count; i++)
|
|
|
{
|
|
|
WmsCheckStockZone checkStockZone = new WmsCheckStockZone();
|
|
|
checkStockZone.ZoneId = zoneNameDetailRowList[i].ZoneId;
|
|
|
checkStockZone.ZoneName = zoneNameDetailRowList[i].ZoneName;
|
|
|
checkStockZone.FactoryId = factoryId;
|
|
|
checkStockZone.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockZoneList.Add(checkStockZone);
|
|
|
}
|
|
|
|
|
|
List<WmsCheckStockLocate> checkStockLocateList = new List<WmsCheckStockLocate>();
|
|
|
|
|
|
for (int i = 0; i < locateNameDetailRowList.Count; i++)
|
|
|
{
|
|
|
WmsCheckStockLocate checkStockLocate = new WmsCheckStockLocate();
|
|
|
checkStockLocate.LocateId = locateNameDetailRowList[i].LocateId;
|
|
|
checkStockLocate.LocateName = locateNameDetailRowList[i].LocateName;
|
|
|
checkStockLocate.FactoryId = factoryId;
|
|
|
checkStockLocate.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockLocateList.Add(checkStockLocate);
|
|
|
}
|
|
|
|
|
|
|
|
|
List<WmsCheckStockRange> checkStockRangeList = new List<WmsCheckStockRange>();
|
|
|
if (zoneNameDetailRowList.Count != 0)
|
|
|
{
|
|
|
for (int i = 0; i < zoneNameDetailRowList.Count; i++)
|
|
|
{
|
|
|
if (partNoDetailRowList.Count == 0)
|
|
|
{
|
|
|
WmsCheckStockRange checkStockRange = new WmsCheckStockRange();
|
|
|
checkStockRange.ZoneId = zoneNameDetailRowList[i].ZoneId;
|
|
|
checkStockRange.ZoneName = string.IsNullOrEmpty(zoneNameDetailRowList[i].ZoneName) ? "" : zoneNameDetailRowList[i].ZoneName;
|
|
|
checkStockRange.LocateId = 0;
|
|
|
checkStockRange.LocateName = "";
|
|
|
checkStockRange.PartId = 0;
|
|
|
checkStockRange.PartNo = "";
|
|
|
checkStockRange.PartSpec = "";
|
|
|
checkStockRange.FactoryId = factoryId;
|
|
|
checkStockRange.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockRangeList.Add(checkStockRange);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for (int j = 0; j < partNoDetailRowList.Count; j++)
|
|
|
{
|
|
|
WmsCheckStockRange checkStockRange = new WmsCheckStockRange();
|
|
|
checkStockRange.ZoneId = zoneNameDetailRowList[i].ZoneId;
|
|
|
checkStockRange.ZoneName = string.IsNullOrEmpty(zoneNameDetailRowList[i].ZoneName) ? "" : zoneNameDetailRowList[i].ZoneName;
|
|
|
checkStockRange.LocateId = 0;
|
|
|
checkStockRange.LocateName = "";
|
|
|
checkStockRange.PartId = partNoDetailRowList[j].PartId;
|
|
|
checkStockRange.PartNo = partNoDetailRowList[j].PartNo;
|
|
|
checkStockRange.PartSpec = string.IsNullOrEmpty(partNoDetailRowList[j].PartSpec) ? "" : partNoDetailRowList[j].PartSpec;
|
|
|
checkStockRange.FactoryId = factoryId;
|
|
|
checkStockRange.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockRangeList.Add(checkStockRange);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (locateNameDetailRowList.Count != 0)
|
|
|
{
|
|
|
for (int i = 0; i < locateNameDetailRowList.Count; i++)
|
|
|
{
|
|
|
if (partNoDetailRowList.Count == 0)
|
|
|
{
|
|
|
WmsCheckStockRange checkStockRange = new WmsCheckStockRange();
|
|
|
checkStockRange.ZoneId = 0;
|
|
|
checkStockRange.ZoneName = "";
|
|
|
checkStockRange.LocateId = locateNameDetailRowList[i].LocateId;
|
|
|
checkStockRange.LocateName = string.IsNullOrEmpty(locateNameDetailRowList[i].LocateName) ? "" : locateNameDetailRowList[i].LocateName;
|
|
|
checkStockRange.PartId = 0;
|
|
|
checkStockRange.PartNo = "";
|
|
|
checkStockRange.PartSpec = "";
|
|
|
checkStockRange.FactoryId = factoryId;
|
|
|
checkStockRange.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockRangeList.Add(checkStockRange);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for (int j = 0; j < partNoDetailRowList.Count; j++)
|
|
|
{
|
|
|
WmsCheckStockRange checkStockRange = new WmsCheckStockRange();
|
|
|
checkStockRange.ZoneId = 0;
|
|
|
checkStockRange.ZoneName = "";
|
|
|
checkStockRange.LocateId = locateNameDetailRowList[i].LocateId;
|
|
|
checkStockRange.LocateName = string.IsNullOrEmpty(locateNameDetailRowList[i].LocateName) ? "" : locateNameDetailRowList[i].LocateName;
|
|
|
checkStockRange.PartId = partNoDetailRowList[j].PartId;
|
|
|
checkStockRange.PartNo = partNoDetailRowList[j].PartNo;
|
|
|
checkStockRange.PartSpec = string.IsNullOrEmpty(partNoDetailRowList[j].PartSpec) ? "" : partNoDetailRowList[j].PartSpec;
|
|
|
checkStockRange.FactoryId = factoryId;
|
|
|
checkStockRange.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockRangeList.Add(checkStockRange);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for (int j = 0; j < partNoDetailRowList.Count; j++)
|
|
|
{
|
|
|
WmsCheckStockRange checkStockRange = new WmsCheckStockRange();
|
|
|
checkStockRange.ZoneId = 0;
|
|
|
checkStockRange.ZoneName = "";
|
|
|
checkStockRange.LocateId = 0;
|
|
|
checkStockRange.LocateName = "";
|
|
|
checkStockRange.PartId = partNoDetailRowList[j].PartId;
|
|
|
checkStockRange.PartNo = partNoDetailRowList[j].PartNo;
|
|
|
checkStockRange.PartSpec = string.IsNullOrEmpty(partNoDetailRowList[j].PartSpec) ? "" : partNoDetailRowList[j].PartSpec;
|
|
|
checkStockRange.FactoryId = factoryId;
|
|
|
checkStockRange.FactoryCode = factoryCode;
|
|
|
|
|
|
checkStockRangeList.Add(checkStockRange);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String message = "";
|
|
|
|
|
|
try
|
|
|
{
|
|
|
checkStock.CreateUserId = CurrentEmp.EmpId;
|
|
|
bool bl = this.service.saveCycleCountManage(checkStock, checkStockPartList, checkStockZoneList, checkStockLocateList, checkStockRangeList);
|
|
|
|
|
|
if (bl == true)
|
|
|
{
|
|
|
message = "添加成功";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("message", message);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult GetErpwarehouse()
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable resault = new Hashtable();
|
|
|
List<KeyValueResult> pdlineList = service.GetErpwarehouse(factoryId);
|
|
|
resault.Add("list", pdlineList);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
|
|
|
//根据库区筛选零件号信息
|
|
|
public ActionResult getPartNoByZoneIds(string zoneIds)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<SysPart> partList = this.service.getPartNoByZoneIds(zoneIds);
|
|
|
result.Add("rows", partList);
|
|
|
result.Add("pager.totalRows", partList.Count);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//根据库位筛选零件号信息
|
|
|
public ActionResult getPartNoByLocateIds(string locateIds)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<SysPart> partList = this.service.getPartNoByLocateIds(locateIds);
|
|
|
result.Add("rows", partList);
|
|
|
result.Add("pager.totalRows", partList.Count);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//根据库区或库位筛选零件号信息
|
|
|
public ActionResult getPartNoByZoneIdsOrLocateIds(string zoneIds, string locateIds)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<SysPart> partList = this.service.getPartNoByZoneIdsOrLocateIds(zoneIds, locateIds);
|
|
|
result.Add("rows", partList);
|
|
|
result.Add("pager.totalRows", partList.Count);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 开始盘点
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onBeginCycle(String orderNo)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
result = this.service.onBeginCycle(orderNo, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
result.Add("status", -1);
|
|
|
result.Add("message", "开始盘点失败");
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//整单解冻调差
|
|
|
public ActionResult onAdjustment(String orderNo)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
SysBase GetSysBase = this.service.GetSAPDIFOByBase();
|
|
|
if (GetSysBase.ParamValue =="N" )
|
|
|
{
|
|
|
//判断不开启接口调差
|
|
|
result = this.service.onAdjustment(orderNo, empId);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//判断开启SAP接口调差
|
|
|
List<SapDifo> sapDifos = this.service.GetSAPDIFO(orderNo, empId);
|
|
|
if (sapDifos.Count == 0)
|
|
|
{
|
|
|
result.Add("status", -1);
|
|
|
result.Add("message", "未得到调差指令,解冻调差失败!");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = this.service.onAdjustment(orderNo, empId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
result.Add("status", -1);
|
|
|
result.Add("message", "整单解冻调差失败");
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//整单解冻不调差
|
|
|
public ActionResult onNoAdjustment(String orderNo)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
result = this.service.onNoAdjustment(orderNo, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
result.Add("status", -1);
|
|
|
result.Add("message", "整单解冻不调差失败");
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//关闭盘点
|
|
|
public ActionResult onCloseCycle(String orderNo)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
result = this.service.onCloseCycle(orderNo, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
result.Add("status", -1);
|
|
|
result.Add("message", "关闭盘点指令失败");
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//完成盘点
|
|
|
public ActionResult onCompleteCycle(String orderNo)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
result = this.service.onCompleteCycle(orderNo, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
result.Add("status", -1);
|
|
|
result.Add("message", "完成盘点失败");
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//复盘
|
|
|
public ActionResult onReplay(String orderNo)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
result = this.service.onReplay(orderNo, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
result.Add("status", -1);
|
|
|
result.Add("message", "复盘失败");
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 关闭
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onClose(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
delCount = this.service.onClose(ids, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onEnable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
delCount = this.service.EnableData(ids, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onDisable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
delCount = this.service.DisableData(ids, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
//导出
|
|
|
public ActionResult exportData(String orderNo)
|
|
|
{
|
|
|
List<CycleCountList> dataHt = this.service.getCheckStockListByExportData(orderNo);
|
|
|
var memoryStream = ExcelHelper.ToExcel(dataHt);
|
|
|
string dateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
return File(memoryStream.ToArray(), "application/ms-excel", "盘点单列表明细" + dateTime + ".xls");
|
|
|
}
|
|
|
}
|
|
|
}
|