217 lines
5.8 KiB
C#
217 lines
5.8 KiB
C#
|
|
|||
|
/// <summary>
|
|||
|
///LOGIC CLASS FOR TABLE t_WmsPlate
|
|||
|
///By wm with codesmith.
|
|||
|
///on 04/06/2020
|
|||
|
/// </summary>
|
|||
|
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using DeiNiu.wms.Data.Model;
|
|||
|
using System.Data;
|
|||
|
using System.Transactions;
|
|||
|
using DeiNiu.Utils;
|
|||
|
|
|||
|
namespace DeiNiu.wms.Logical
|
|||
|
{
|
|||
|
[Serializable]
|
|||
|
public class lWmsPlate :lbase
|
|||
|
{
|
|||
|
WmsPlate _obj;
|
|||
|
public lWmsPlate()
|
|||
|
{
|
|||
|
initialize();
|
|||
|
}
|
|||
|
|
|||
|
public WmsPlate getWmsPlate
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_obj == null)
|
|||
|
{
|
|||
|
_obj = new WmsPlate();
|
|||
|
|
|||
|
}
|
|||
|
_obj.operater = operId;
|
|||
|
return _obj;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public lWmsPlate(int operId)
|
|||
|
: base(operId)
|
|||
|
{
|
|||
|
initialize();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get all data
|
|||
|
/// </summary>
|
|||
|
public DataSet getAllData()
|
|||
|
{
|
|||
|
return _obj.Query();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get all data
|
|||
|
/// </summary>
|
|||
|
public DataSet getAllActiveData()
|
|||
|
{
|
|||
|
return _obj.QueryActived();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get a record by id
|
|||
|
/// </summary>
|
|||
|
public void initialize(int id)
|
|||
|
{
|
|||
|
_obj = id != 0 ? new WmsPlate(id) : new WmsPlate();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get a record by id 0
|
|||
|
/// </summary>
|
|||
|
public void initialize()
|
|||
|
{
|
|||
|
initialize(0);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get a record by id
|
|||
|
/// </summary>
|
|||
|
public void initialize(DataRow dr)
|
|||
|
{
|
|||
|
_obj = new WmsPlate(dr);
|
|||
|
}
|
|||
|
|
|||
|
protected override DeiNiu.Data.BaseObject.BaseModel getModel()
|
|||
|
{
|
|||
|
return _obj;
|
|||
|
}
|
|||
|
|
|||
|
//begin cust db operation, query, excute sql etc.
|
|||
|
|
|||
|
internal int add(WmsPlate obj,int count)
|
|||
|
{
|
|||
|
for (int i = 0; i < count; i++)
|
|||
|
{
|
|||
|
|
|||
|
obj.Add();
|
|||
|
obj.plateId = Util.getBoxId(obj.type, obj.color, obj.ID);
|
|||
|
obj.Update();
|
|||
|
}
|
|||
|
return 1;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// put goods into a plate
|
|||
|
/// </summary>
|
|||
|
|
|||
|
public enumRegPlateResult inPlate(string plateId,enumPlateStatus type, string goodsId,string barcode,int skuId,decimal count,string orderNo)
|
|||
|
{
|
|||
|
if (valid( plateId, type, goodsId, skuId) == enumRegPlateResult.成功)
|
|||
|
{
|
|||
|
using (TransactionScope scope = new TransactionScope())
|
|||
|
{
|
|||
|
WmsPlate plate = new WmsPlate(plateId);
|
|||
|
plate.type =(int)type;
|
|||
|
WmsPlateStock_tmp pst = new WmsPlateStock_tmp(plateId,skuId);
|
|||
|
if (pst.ID == 0)
|
|||
|
{
|
|||
|
pst.plateId = plateId;
|
|||
|
pst.goodsId = goodsId;
|
|||
|
pst.skuId = skuId;
|
|||
|
pst.count = count;
|
|||
|
pst.operater = operId;
|
|||
|
pst.barcode = barcode;
|
|||
|
pst.Add();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
pst.count += count;
|
|||
|
pst.operater = operId;
|
|||
|
pst.Update();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
switch (type)
|
|||
|
{
|
|||
|
// case enumPlateStatus.播种周转:
|
|||
|
// plate.customerId = orderNo;
|
|||
|
// break;
|
|||
|
case enumPlateStatus.存储架上:
|
|||
|
plate.locationId = orderNo;
|
|||
|
break;
|
|||
|
case enumPlateStatus.临时堆放:
|
|||
|
break;
|
|||
|
case enumPlateStatus.入库待上架:
|
|||
|
plate.preInOrderNo = orderNo;
|
|||
|
break;
|
|||
|
case enumPlateStatus.摘果周转:
|
|||
|
plate.pickOrderNo = orderNo;
|
|||
|
break;
|
|||
|
|
|||
|
case enumPlateStatus.运输周转:
|
|||
|
plate.transNo = orderNo;
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
plate.operater = operId;
|
|||
|
plate.Update();
|
|||
|
|
|||
|
scope.Complete();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return enumRegPlateResult.成功;
|
|||
|
}
|
|||
|
|
|||
|
private enumRegPlateResult valid(string plateId, enumPlateStatus type, string goodsId, int skuId)
|
|||
|
{
|
|||
|
|
|||
|
if (enumPlateStatus.入库待上架 == type)
|
|||
|
{
|
|||
|
WmsPlateStock_tmp pst = new WmsPlateStock_tmp();
|
|||
|
DataTable dt = pst.getPlateStockDetail(plateId);
|
|||
|
if (dt.Rows.Count == 0)
|
|||
|
{
|
|||
|
return enumRegPlateResult.成功;
|
|||
|
}
|
|||
|
foreach (DataRow dr in dt.Rows)
|
|||
|
{
|
|||
|
if (dr["goodsId"].ToString() == goodsId)//存在goodsid
|
|||
|
{
|
|||
|
return enumRegPlateResult.成功;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
WmsGoods wg = new WmsGoods(goodsId);
|
|||
|
foreach (DataRow dr in dt.Rows)
|
|||
|
{
|
|||
|
if (Convert.ToInt16(dr["goodsType"].ToString()) == wg.goodsType)//存在goods type
|
|||
|
{
|
|||
|
return enumRegPlateResult.成功;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return enumRegPlateResult.容器已被不同库区或类型物品使用;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return enumRegPlateResult.成功;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|