2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///INTERFACE CLASS FOR TABLE t_wmsGoods
|
|
|
|
|
///By wm with codesmith.
|
|
|
|
|
///on 05/04/2017
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using DeiNiu.Utils;
|
|
|
|
|
|
|
|
|
|
namespace DeiNiu.wms.Data.Model
|
|
|
|
|
{
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class WmsGoods : WmsGoods_base
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WmsGoods()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public WmsGoods(int id): base(id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public WmsGoods(DataRow dr): base(dr)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public WmsGoods(string goodsId)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = goodsId;
|
|
|
|
|
getModel(110);
|
|
|
|
|
initialExtFields();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 实例化商品,并取sku库存信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="goodsId"></param>
|
|
|
|
|
/// <param name="skuId"></param>
|
|
|
|
|
/// <param name="skuCode"></param>
|
|
|
|
|
public WmsGoods(string goodsId, int skuId,string batch,enumWhType whType = enumWhType.合格库)
|
|
|
|
|
: this(goodsId)
|
|
|
|
|
{
|
|
|
|
|
getStockInfo(goodsId, skuId, batch, whType);
|
|
|
|
|
}
|
|
|
|
|
protected override void getImp()
|
|
|
|
|
{
|
|
|
|
|
model_imp = new WmsGoods_Imp();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新cache
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public new int Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
|
|
|
|
// ObjectsFactory.putGoods(this);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region fieldNames
|
|
|
|
|
public enum exfields
|
|
|
|
|
{ goodsName, spec,unit,manufacturer,address,barcode, regeditCode,
|
2023-09-04 22:41:19 +08:00
|
|
|
|
goodsTypeName,type,pinYin ,station,repTypeName,
|
2023-05-23 16:13:17 +08:00
|
|
|
|
lotId,lotName,isDateValid
|
|
|
|
|
,
|
2023-09-04 22:41:19 +08:00
|
|
|
|
bigCount,
|
2023-05-23 16:13:17 +08:00
|
|
|
|
price
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
,
|
|
|
|
|
packingUnit
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
,
|
|
|
|
|
isZhitong
|
|
|
|
|
,
|
|
|
|
|
isQc
|
|
|
|
|
,
|
|
|
|
|
isManufacture
|
|
|
|
|
, messureModel
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string _goodsName, _spec, _unit, _manufacturer, _address, _barcode,
|
|
|
|
|
_regeditCode, _goodsTypeName, _type,_pinyin,
|
|
|
|
|
_lotName
|
2023-09-04 22:41:19 +08:00
|
|
|
|
// ,_expiryDays
|
2023-05-23 16:13:17 +08:00
|
|
|
|
,_price
|
2023-09-04 22:41:19 +08:00
|
|
|
|
// ,_minOperateCount
|
2023-05-23 16:13:17 +08:00
|
|
|
|
,_packingUnit
|
2023-09-04 22:41:19 +08:00
|
|
|
|
// , _minOperateUnit
|
2023-05-23 16:13:17 +08:00
|
|
|
|
, _isZhitong
|
|
|
|
|
, _isQc
|
|
|
|
|
, _isManufacture
|
|
|
|
|
, _messureModel
|
|
|
|
|
;
|
|
|
|
|
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
public string price
|
|
|
|
|
{
|
|
|
|
|
get { return _price; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
public string packingUnit
|
|
|
|
|
{
|
|
|
|
|
get { return _packingUnit; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool isZhitong
|
|
|
|
|
{
|
2024-04-12 09:43:41 +08:00
|
|
|
|
get { return /*_canZhitong || */!String.IsNullOrEmpty(_isZhitong) &&(_isZhitong.Equals("1") || _isZhitong.Equals("True")); }
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
2023-11-21 19:18:23 +08:00
|
|
|
|
public bool isZhitongFromStore
|
|
|
|
|
{
|
|
|
|
|
get { return canZhitong && WmsConstants.OUT_ZHITONG_FROM_STORE; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
public bool isQc
|
2023-05-23 16:13:17 +08:00
|
|
|
|
{
|
|
|
|
|
get {
|
|
|
|
|
return Convert.ToBoolean(_isQc);
|
|
|
|
|
// return !String.IsNullOrEmpty(_isQc) &&_isQc.Equals("1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool isManufacture
|
|
|
|
|
{
|
|
|
|
|
get { return !String.IsNullOrEmpty(_isManufacture) &&_isManufacture.Equals("1"); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string messureModel
|
|
|
|
|
{
|
|
|
|
|
get { return _messureModel; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
private int _lotId;
|
|
|
|
|
private bool _isDateValid;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 商品的有效批次规则
|
|
|
|
|
/// 如果plotId=0 则取owner的LotId
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int lotId
|
|
|
|
|
{
|
|
|
|
|
get { return _lotId; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string lotName
|
|
|
|
|
{
|
|
|
|
|
get { return _lotName; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string goodsName
|
|
|
|
|
{
|
|
|
|
|
get { return _goodsName; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string spec
|
|
|
|
|
{
|
|
|
|
|
get { return _spec; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string unit
|
|
|
|
|
{
|
|
|
|
|
get { return _unit; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string manufacturer
|
|
|
|
|
{
|
|
|
|
|
get { return _manufacturer; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string address
|
|
|
|
|
{
|
|
|
|
|
get { return _address; }
|
|
|
|
|
|
|
|
|
|
}
|
2023-12-03 22:13:49 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
public string regeditCode
|
|
|
|
|
{
|
|
|
|
|
get { return _regeditCode; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string goodsTypeName
|
|
|
|
|
{
|
|
|
|
|
get { return _goodsTypeName; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string type
|
|
|
|
|
{
|
|
|
|
|
get { return _type; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string pinyin
|
|
|
|
|
{
|
|
|
|
|
get { return _pinyin; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void initialExtFields()
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = _goodsId;
|
|
|
|
|
|
|
|
|
|
DataTable dt = CustQuery(120).Tables[0];
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
if (!(dr[exfields.address.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_address = dr[exfields.address.ToString()].ToString();
|
|
|
|
|
}
|
2023-12-03 22:13:49 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
if (!(dr[exfields.goodsName.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_goodsName = dr[exfields.goodsName.ToString()].ToString();
|
|
|
|
|
} if (!(dr[exfields.goodsTypeName.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_goodsTypeName = dr[exfields.goodsTypeName.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.manufacturer.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_manufacturer = dr[exfields.manufacturer.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.regeditCode.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_regeditCode = dr[exfields.regeditCode.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.spec.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_spec = dr[exfields.spec.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.type.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_type = dr[exfields.type.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.unit.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_unit = dr[exfields.unit.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.pinYin.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_pinyin = dr[exfields.pinYin.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.lotId.ToString()] is DBNull))
|
|
|
|
|
{
|
2023-09-04 22:41:19 +08:00
|
|
|
|
_lotId = Convert.ToInt32(dr[exfields.lotId.ToString()].ToString());
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.lotName.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_lotName = dr[exfields.lotName.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.isDateValid.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_isDateValid = Convert.ToBoolean(dr[exfields.isDateValid.ToString()]);
|
|
|
|
|
_isDateValid = Convert.ToBoolean(dr[exfields.isDateValid.ToString()].ToString().Equals("True"));
|
|
|
|
|
}
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
if (!(dr[exfields.price.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_price = dr[exfields.price.ToString()].ToString();
|
|
|
|
|
}
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
if (!(dr[exfields.packingUnit.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_packingUnit = dr[exfields.packingUnit.ToString()].ToString();
|
|
|
|
|
}
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
if (!(dr[exfields.isZhitong.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_isZhitong = dr[exfields.isZhitong.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.isQc.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_isQc = dr[exfields.isQc.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.isManufacture.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_isManufacture = dr[exfields.isManufacture.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(dr[exfields.isManufacture.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_isManufacture = dr[exfields.isManufacture.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (!(dr[exfields.messureModel.ToString()] is DBNull))
|
|
|
|
|
{
|
|
|
|
|
_messureModel = dr[exfields.messureModel.ToString()].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//begin cust db operation, query, excute sql etc.
|
|
|
|
|
public DataSet QueryByName(string name)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = name;
|
|
|
|
|
return CustQuery(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 同步erp 商品信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public int syncGoods()
|
|
|
|
|
{
|
|
|
|
|
int cnt= CustOper(300);
|
|
|
|
|
|
|
|
|
|
DataTable dt = CustQuery(700).Tables[0]; //新的存储类型
|
|
|
|
|
DataTable dtGd;
|
|
|
|
|
string locType;
|
|
|
|
|
Node nd;
|
|
|
|
|
WmsGoods wg;
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
locType = dr[0].ToString();
|
|
|
|
|
|
|
|
|
|
nd = new Node();
|
|
|
|
|
nd.parentid = 29;
|
|
|
|
|
nd.name = locType;
|
|
|
|
|
nd.Add();
|
|
|
|
|
cmdParameters[0] = locType;
|
2023-09-04 22:41:19 +08:00
|
|
|
|
cmdParameters[1] = nd.ID;
|
|
|
|
|
CustOper(810);
|
|
|
|
|
/*
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
dtGd = CustQuery(800).Tables[0];
|
|
|
|
|
|
|
|
|
|
foreach (DataRow dr1 in dtGd.Rows)
|
|
|
|
|
{
|
|
|
|
|
wg = new WmsGoods(dr1["goodsId"].ToString());
|
|
|
|
|
wg._goodsType = nd.ID;
|
|
|
|
|
wg.Update();
|
|
|
|
|
|
|
|
|
|
}
|
2023-09-04 22:41:19 +08:00
|
|
|
|
*/
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cnt;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据货位类型返回货物的库容量
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="locVolType"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public decimal getMaxCount(int locVolType)
|
|
|
|
|
{
|
2023-11-21 19:18:23 +08:00
|
|
|
|
decimal goodsMaxcnt = WmsConstants.BULK_MAX_RATE;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
switch (locVolType)
|
|
|
|
|
{
|
|
|
|
|
case (int)enumWhLocVol.零库:
|
|
|
|
|
goodsMaxcnt = this.bulkMax;
|
|
|
|
|
goodsMaxcnt = goodsMaxcnt > 0 ? goodsMaxcnt : bigCount * WmsConstants.BULK_MAX_RATE;
|
|
|
|
|
break;
|
|
|
|
|
case (int)enumWhLocVol.小整:
|
|
|
|
|
goodsMaxcnt = this.batchMax1;
|
|
|
|
|
goodsMaxcnt = goodsMaxcnt > 0 ? goodsMaxcnt : bigCount * WmsConstants.BATCH1_MAX_RATE;
|
|
|
|
|
break;
|
|
|
|
|
case (int)enumWhLocVol.中整:
|
|
|
|
|
goodsMaxcnt = this.batchMax2;
|
|
|
|
|
goodsMaxcnt = goodsMaxcnt > 0 ? goodsMaxcnt : bigCount * WmsConstants.BATCH2_MAX_RATE;
|
|
|
|
|
break;
|
|
|
|
|
case (int)enumWhLocVol.大整:
|
|
|
|
|
goodsMaxcnt = this.batchMax3;
|
|
|
|
|
goodsMaxcnt = goodsMaxcnt > 0 ? goodsMaxcnt : bigCount * WmsConstants.BATCH3_MAX_RATE;
|
|
|
|
|
break;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return goodsMaxcnt;
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
private decimal _stockSumCount, _stockBulkCount, _stockBatch1Count, _stockBatch2Count, _stockBatch3Count,_stockSumAjustCount;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
private decimal _stockSumCountIn, _stockBulkCountIn, _stockBatch1CountIn, _stockBatch2CountIn, _stockBatch3CountIn;
|
2024-02-06 19:36:47 +08:00
|
|
|
|
private decimal _stockSumCountOuting, _stockBulkCountOuting, _stockBatch1CountOuting, _stockBatch2CountOuting, _stockBatch3CountOuting, _stockSumVirtialCount;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
public decimal stockSumCountIn
|
|
|
|
|
{
|
|
|
|
|
get { return _stockSumCountIn; }
|
|
|
|
|
|
2023-11-21 19:18:23 +08:00
|
|
|
|
}
|
|
|
|
|
public decimal stockSumAjustCount
|
|
|
|
|
{
|
|
|
|
|
get { return _stockSumAjustCount; }
|
|
|
|
|
|
2023-09-04 22:41:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public decimal stockAvCount
|
|
|
|
|
{
|
2024-02-06 19:36:47 +08:00
|
|
|
|
get {
|
|
|
|
|
|
|
|
|
|
decimal tmp = _stockSumCount - _stockSumCountOuting + _stockSumAjustCount + _stockSumVirtialCount;
|
2024-04-16 09:29:04 +08:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
tmp = isWeightOut() ? tmp : ((int)(tmp / minOperateCount)) * minOperateCount;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
2024-04-16 09:29:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-12 09:43:41 +08:00
|
|
|
|
|
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
return tmp >= 0? tmp : 0;
|
|
|
|
|
}
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
public decimal stockBulkCountIn
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBulkCountIn; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatch1CountIn
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch1CountIn; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatch2CountIn
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch2CountIn; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public decimal stockSumCountOuting
|
|
|
|
|
{
|
|
|
|
|
get { return _stockSumCountOuting; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBulkCountOuting
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBulkCountOuting; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatch1CountOuting
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch1CountOuting; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatch2CountOuting
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch2CountOuting; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatch3CountOuting
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch3CountOuting; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public decimal stockSumCount
|
|
|
|
|
{
|
|
|
|
|
get { return _stockSumCount; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBulkCount
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBulkCount; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBulkAvCount
|
|
|
|
|
{
|
2024-02-06 19:36:47 +08:00
|
|
|
|
get { return _stockBulkCount - _stockBulkCountOuting + _stockSumVirtialCount; }
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatchAvCount
|
|
|
|
|
{
|
|
|
|
|
get {
|
2024-04-12 09:43:41 +08:00
|
|
|
|
return stockAvCount - stockBulkAvCount;
|
|
|
|
|
// return _stockSumCount - _stockSumCountOuting - stockBulkAvCount;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public bool canRep(string skuId)
|
|
|
|
|
{
|
|
|
|
|
if (skuId == "3724")
|
|
|
|
|
LogHelper.debug(this.GetType(), "canRep skuid=" + skuId);
|
|
|
|
|
decimal repcnt=0M, pickbulkcnt=0M;
|
|
|
|
|
cmdParameters[0] = skuId;
|
|
|
|
|
DataSet ds = CustQuery(900);
|
|
|
|
|
DataTable dt = ds.Tables[0];
|
|
|
|
|
DataTable dt2 = ds.Tables[1];
|
|
|
|
|
|
|
|
|
|
if (dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
repcnt = Convert.ToDecimal( dt.Rows[0][0].ToString());
|
|
|
|
|
}
|
|
|
|
|
if (dt2.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
pickbulkcnt = Convert.ToDecimal(dt2.Rows[0][0].ToString());
|
|
|
|
|
}
|
|
|
|
|
if (skuId == "3724")
|
|
|
|
|
LogHelper.debug(this.GetType(), string.Format("{0} repcnt:{1},pickbulkcnt:{2}, can rep: {3}", skuId, repcnt, pickbulkcnt, pickbulkcnt > repcnt));
|
|
|
|
|
return pickbulkcnt > repcnt;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal sumBulkOuting(string skuId)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = skuId;
|
|
|
|
|
DataSet ds = CustQuery(900);
|
|
|
|
|
DataTable dt2 = ds.Tables[1];
|
|
|
|
|
return Convert.ToDecimal(dt2.Rows[0][0].ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DataTable getRepLst()
|
|
|
|
|
{
|
|
|
|
|
return CustQuery(1000).Tables[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public decimal stockBatch1Count
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch1Count; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatch2Count
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch2Count; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public decimal stockBatch3Count
|
|
|
|
|
{
|
|
|
|
|
get { return _stockBatch3Count; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private List<WmsStock> _stocks;
|
|
|
|
|
|
|
|
|
|
public List<WmsStock> stocks
|
|
|
|
|
{
|
|
|
|
|
get {
|
|
|
|
|
if (_stocks == null)
|
|
|
|
|
{
|
|
|
|
|
_stocks = new List<WmsStock>();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _stocks;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-04 22:41:19 +08:00
|
|
|
|
}
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
private List<WmsStock> _allStocks;
|
|
|
|
|
|
|
|
|
|
public List<WmsStock> AllStocks
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_allStocks == null)
|
|
|
|
|
{
|
|
|
|
|
_allStocks = new List<WmsStock>();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _allStocks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-04 22:41:19 +08:00
|
|
|
|
private List<WmsStock> _tmpStocks;
|
|
|
|
|
public List<WmsStock> tmpStocks
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_tmpStocks == null)
|
|
|
|
|
{
|
|
|
|
|
_tmpStocks = new List<WmsStock>();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _tmpStocks;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_tmpStocks = value;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataTable getSkuValues(int lotId,int skuId, string attName)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = skuId;
|
|
|
|
|
cmdParameters[1] = attName;
|
|
|
|
|
cmdParameters[2] = lotId;
|
|
|
|
|
return CustQuery(400).Tables[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取得商品的即时库存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="goodsId"></param>
|
|
|
|
|
/// <param name="batch"></param>
|
|
|
|
|
public void getStockInfo(string goodsId,int skuId=0,string batch="", enumWhType whType = enumWhType.合格库)
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = new WmsStock().getStockInfo(goodsId, skuId, batch,whType);
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_stocks = new List<WmsStock>();
|
|
|
|
|
_allStocks = new List<WmsStock>();
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
_stockSumCount = 0m; _stockBulkCount = 0m; _stockBatch1Count = 0m; _stockBatch2Count = 0m;
|
|
|
|
|
_stockSumCountIn = 0m; _stockBulkCountIn = 0m; _stockBatch1CountIn = 0m; _stockBatch2CountIn = 0m;
|
|
|
|
|
_stockSumCountOuting = 0m; _stockBulkCountOuting = 0m; _stockBatch1CountOuting = 0m; _stockBatch2CountOuting = 0m;
|
2024-02-06 19:36:47 +08:00
|
|
|
|
_stockSumVirtialCount = 0m;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
_stockSumAjustCount = 0m;
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
// if(goodsId=="P04710")
|
|
|
|
|
// LogHelper.debug(GetType(), String.Format("to get stk info, goodsId {0},stk cnt {1}", goodsId, dt.Rows.Count));
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
foreach (DataRow dr in dt.Rows){
|
|
|
|
|
|
|
|
|
|
WmsStock st = new WmsStock(dr);
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
// if (goodsId == "P04710")
|
|
|
|
|
// LogHelper.debug(GetType(), String.Format("to get stk info, stk {0}", st.ToString()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_allStocks.Add(st);
|
2024-11-15 23:52:43 +08:00
|
|
|
|
/*
|
2024-02-06 19:36:47 +08:00
|
|
|
|
if (st.getAvCount() <= 0)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-12 09:43:41 +08:00
|
|
|
|
if ( ( isWeightOut() ? st.getAvCount() : ((int)(st.getAvCount() / minOperateCount)) * minOperateCount) <=0 )
|
|
|
|
|
{
|
|
|
|
|
LogHelper.debug(GetType(), String.Format(" 达不到可拣选的最小数量 to get stk info, stk {0}", st.ToString()));
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2024-11-15 23:52:43 +08:00
|
|
|
|
*/
|
|
|
|
|
if (!isWeightOut() && st.getAvCount()>0 && st.getAvCount()< minOperateCount )
|
|
|
|
|
{
|
|
|
|
|
LogHelper.debug(GetType(), String.Format(" 达不到可拣选的最小数量 to get stk info, stk {0}", st.ToString()));
|
2024-04-12 09:43:41 +08:00
|
|
|
|
|
2024-11-15 23:52:43 +08:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2024-04-12 09:43:41 +08:00
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
_stocks.Add(st);
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
decimal cnt = st.count - st.countOut;
|
2024-04-12 09:43:41 +08:00
|
|
|
|
|
|
|
|
|
cnt = isWeightOut() ? cnt : ((int)(cnt / minOperateCount)) * minOperateCount; //取可拣选的最小单位的倍数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
_stockSumCount += cnt;
|
|
|
|
|
_stockSumCountIn +=st.countIn;
|
2023-11-21 19:18:23 +08:00
|
|
|
|
_stockSumCountOuting += st.countOuting;
|
|
|
|
|
_stockSumAjustCount += st.adjustingCnt;
|
2024-02-06 19:36:47 +08:00
|
|
|
|
_stockSumVirtialCount += st.virtialCount;
|
2023-05-23 16:13:17 +08:00
|
|
|
|
switch (st.location.volType)
|
|
|
|
|
{
|
|
|
|
|
case (int) enumWhLocVol.零库:
|
|
|
|
|
_stockBulkCount += cnt;
|
|
|
|
|
_stockBulkCountIn += st.countIn;
|
|
|
|
|
_stockBulkCountOuting += st.countOuting;
|
|
|
|
|
break;
|
|
|
|
|
case (int)enumWhLocVol.小整:
|
|
|
|
|
_stockBatch1Count += cnt;
|
|
|
|
|
_stockBatch1CountIn += st.countIn;
|
|
|
|
|
_stockBatch1CountOuting += st.countOuting;
|
|
|
|
|
break;
|
|
|
|
|
case (int)enumWhLocVol.中整:
|
|
|
|
|
_stockBatch2Count += cnt;
|
|
|
|
|
_stockBatch2CountIn += st.countIn;
|
|
|
|
|
_stockBatch2CountOuting += st.countOuting;
|
|
|
|
|
break;
|
|
|
|
|
case (int)enumWhLocVol.大整:
|
|
|
|
|
_stockBatch3Count += cnt;
|
|
|
|
|
_stockBatch3CountIn += st.countIn;
|
|
|
|
|
_stockBatch3CountOuting += st.countOuting;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
|
|
|
|
|
public DataTable queryPacking(string goodsId)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = goodsId;
|
|
|
|
|
|
|
|
|
|
return CustQuery(500).Tables[0];
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-27 10:40:55 +08:00
|
|
|
|
|
|
|
|
|
public DataTable queryByKeyWords(string keyWords)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = keyWords;
|
|
|
|
|
|
|
|
|
|
return CustQuery(1100).Tables[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:13:17 +08:00
|
|
|
|
public DataTable getGoodsBybarcod(string barcode)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = barcode;
|
|
|
|
|
|
|
|
|
|
return CustQuery(600).Tables[0];
|
|
|
|
|
}
|
|
|
|
|
public DataTable getGoodsDetailBybarcode(string barcode)
|
|
|
|
|
{
|
|
|
|
|
cmdParameters[0] = barcode;
|
|
|
|
|
|
|
|
|
|
return CustQuery(610).Tables[0];
|
|
|
|
|
}
|
2023-09-04 22:41:19 +08:00
|
|
|
|
|
|
|
|
|
public List<string> getLotAtts()
|
|
|
|
|
{
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
LotAtt lotAtt = new LotAtt();
|
|
|
|
|
DataTable dt =lotAtt.queryByLotId(lotId);
|
|
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
lotAtt = new LotAtt(dr);
|
|
|
|
|
list.Add(lotAtt.attName);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
2023-12-03 22:13:49 +08:00
|
|
|
|
|
|
|
|
|
public bool isWeightOut()
|
|
|
|
|
{
|
|
|
|
|
//return WmsConstants.GOODS_WEIGHT_UNITS.Contains(unit);
|
|
|
|
|
return WmsConstants.GOODS_WEIGHT_UNITS.Contains(this.minOperateUnit);
|
|
|
|
|
}
|
2024-04-12 09:43:41 +08:00
|
|
|
|
|
2024-02-06 19:36:47 +08:00
|
|
|
|
|
|
|
|
|
public bool isSeedsOut()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
bool b = canSeedOut && !isZhitong //直通不参与
|
|
|
|
|
&& (!isWeightOut() || !WmsConstants.SEEDS_OUT_NOT_WITH_WEIGHT);
|
|
|
|
|
|
|
|
|
|
return b;
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
// bool notSeeds = isZhitong || (isWeightOut() && WmsConstants.SEEDS_OUT_NOT_WITH_WEIGHT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return canSeedOut; //|| !notSeeds;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-05-23 16:13:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|