Browse Source

文档处理,采购入库添加是否现存量判定

master
DESKTOP-DIHMM3I\22375 2 years ago
parent
commit
0ec72ff3de
  1. 63
      ICSSoft.ERP.WebAPI/ICSSoft.DataProject/PurchaseReceiveDoc.cs
  2. 31
      ICSSoft.ERP.WebAPI/ICSSoft.DataProject/PurchaseReceiveDoctNegative.cs
  3. 1
      ICSSoft.ERP.WebAPI/ICSSoft.DataProject/TransferDoc.cs
  4. 6
      ICSSoft.ERP.WebAPI/ICSSoft.ERP.WebAPI/Web.config
  5. 3
      ICSSoft.ERP.WebAPI/ICSSoft.Entity/ICSPurchaseReceiveDoc.cs

63
ICSSoft.ERP.WebAPI/ICSSoft.DataProject/PurchaseReceiveDoc.cs

@ -562,7 +562,8 @@ EXEC PROC_Update_PO_RdRecord01 @ID= @ID1
//sql = @"Update a set iReceivedQTY =isnull(iReceivedQTY ,0)+ @iQty,iReceivedMoney=isnull(iReceivedMoney,0)+@iMoney FROM dbo.PO_Podetails a where a.ID='" + body.iPOsID + "'";
sql = @"
Update a set
iReceivedMoney=isnull(iReceivedMoney,0)+@iMoney
iReceivedQTY =isnull(iReceivedQTY ,0)+ @iQty
,iReceivedMoney=isnull(iReceivedMoney,0)+@iMoney
,freceivedqty=isnull(freceivedqty ,0)+ @iQty
FROM dbo.PO_Podetails a where a.ID=@ID"
;
@ -1271,26 +1272,52 @@ EXEC PROC_Update_PO_RdRecord01 @ID= @ID1
// //DBHelper.UpdateCurrentStock(cmd, body.InvCode, head.WHCode, body.InvCode, body.Quantity, key);
// DBHelper.UpdateCurrentStockNEW(cmd, body.InvCode, head.WHCode, body.BatchCode, body.Quantity, body.cFree1, body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10, key);
//}
key.cBustypeUN = "普通采购";
key.cVouchTypeUN = "01";
key.TableName = "IA_ST_UnAccountVouch01";
if (batch!="")
{
DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, body.BatchCode, body.Quantity, body.Amount, body.cFree1,
body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
gys, key, "", "", "", "", 0, 0, -body.Quantity, -body.Amount, 0, 0, 0, 0, iFatherId, iChildId);
}
else
if (head.UpdateStock)
{
DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, "", 0, 0, body.cFree1,
body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
gys, key, "", "", "", "", 0, 0, -body.Quantity, -body.Amount, 0, 0, 0, 0, iFatherId, iChildId);
DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, body.BatchCode, body.Quantity, body.Amount, body.cFree1,
body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
gys, key, "", "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, iFatherId, iChildId);
key.cBustypeUN = "普通采购";
key.cVouchTypeUN = "01";
key.TableName = "IA_ST_UnAccountVouch01";
if (batch != "")
{
DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, body.BatchCode, body.Quantity, body.Amount, body.cFree1,
body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
gys, key, "", "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, iFatherId, iChildId);
// DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, body.BatchCode, body.Quantity, body.Amount, body.cFree1,
//body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
//gys, key, "", "", "", "", 0, 0, -body.Quantity, -body.Amount, 0, 0, 0, 0, iFatherId, iChildId);
}
else
{
//DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, "", 0, 0, body.cFree1,
//body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
//gys, key, "", "", "", "", 0, 0, -body.Quantity, -body.Amount, 0, 0, 0, 0, iFatherId, iChildId);
DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, body.BatchCode, body.Quantity, body.Amount, body.cFree1,
body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
gys, key, "", "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, iFatherId, iChildId);
}
if (head.UpdateTodoQuantity)
{
key.cBustypeUN = "普通采购";
key.cVouchTypeUN = "01";
key.TableName = "IA_ST_UnAccountVouch01";
if (batch != "")
{
DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, body.BatchCode, 0, 0, body.cFree1,
body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
gys, key, "", "", "", "", 0, 0, -body.Quantity, -body.Amount, 0, 0, 0, 0, iFatherId, iChildId);
}
else
{
DBHelper.UpdateCurrentStockCCGC(cmd, body.InvCode, head.WHCode, "", 0, 0, body.cFree1,
body.cFree2, body.cFree3, body.cFree4, body.cFree5, body.cFree6, body.cFree7, body.cFree8, body.cFree9, body.cFree10,
gys, key, "", "", "", "", 0, 0, -body.Quantity, -body.Amount, 0, 0, 0, 0, iFatherId, iChildId);
}
}
}
iFatherIdTwo = "'" + iFatherId + "',";

31
ICSSoft.ERP.WebAPI/ICSSoft.DataProject/PurchaseReceiveDoctNegative.cs

@ -851,10 +851,17 @@ isnull(b.cFree10,'') as cFree10
key.TableName = "IA_ST_UnAccountVouch01";
//DBHelper.UpdateCurrentStock(cmd, dtChecks.Rows[i]["cInvCode"].ToString(), dtChecks.Rows[i]["cWhCode"].ToString(), "", Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()), key);
//DBHelper.UpdateCurrentStockNEW(cmd, dtChecks.Rows[i]["cInvCode"].ToString(), dtChecks.Rows[i]["cWhCode"].ToString(), dtChecks.Rows[i]["cBatch"].ToString(), Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()), dtChecks.Rows[i]["cFree1"].ToString(), dtChecks.Rows[i]["cFree2"].ToString(), dtChecks.Rows[i]["cFree3"].ToString(), dtChecks.Rows[i]["cFree4"].ToString(), dtChecks.Rows[i]["cFree5"].ToString(), dtChecks.Rows[i]["cFree6"].ToString(), dtChecks.Rows[i]["cFree7"].ToString(), dtChecks.Rows[i]["cFree8"].ToString(), dtChecks.Rows[i]["cFree9"].ToString(), dtChecks.Rows[i]["cFree10"].ToString(), key);
DBHelper.UpdateCurrentStockCCGC(cmd, dtChecks.Rows[i]["cInvCode"].ToString(), dtChecks.Rows[i]["cWhCode"].ToString(), dtChecks.Rows[i]["cBatch"].ToString(), Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()), string.IsNullOrWhiteSpace(dtChecks.Rows[i]["iNum"].ToString())?0:Convert.ToDecimal(dtChecks.Rows[i]["iNum"].ToString()), dtChecks.Rows[i]["cFree1"].ToString(),
dtChecks.Rows[i]["cFree2"].ToString(), dtChecks.Rows[i]["cFree3"].ToString(), dtChecks.Rows[i]["cFree4"].ToString(), dtChecks.Rows[i]["cFree5"].ToString(), dtChecks.Rows[i]["cFree6"].ToString(), dtChecks.Rows[i]["cFree7"].ToString(), dtChecks.Rows[i]["cFree8"].ToString(), dtChecks.Rows[i]["cFree9"].ToString(), dtChecks.Rows[i]["cFree10"].ToString(),
"", key, "", "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, Convert.ToInt32(dtChecks.Rows[i]["ID"].ToString()), Convert.ToInt32(dtChecks.Rows[i]["AutoID"].ToString()));
#region 原
//DBHelper.UpdateCurrentStockCCGC(cmd, dtChecks.Rows[i]["cInvCode"].ToString(), dtChecks.Rows[i]["cWhCode"].ToString(), dtChecks.Rows[i]["cBatch"].ToString(), Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()), string.IsNullOrWhiteSpace(dtChecks.Rows[i]["iNum"].ToString()) ? 0 : Convert.ToDecimal(dtChecks.Rows[i]["iNum"].ToString()), dtChecks.Rows[i]["cFree1"].ToString(),
// dtChecks.Rows[i]["cFree2"].ToString(), dtChecks.Rows[i]["cFree3"].ToString(), dtChecks.Rows[i]["cFree4"].ToString(), dtChecks.Rows[i]["cFree5"].ToString(), dtChecks.Rows[i]["cFree6"].ToString(), dtChecks.Rows[i]["cFree7"].ToString(), dtChecks.Rows[i]["cFree8"].ToString(), dtChecks.Rows[i]["cFree9"].ToString(), dtChecks.Rows[i]["cFree10"].ToString(),
// "", key, "", "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, Convert.ToInt32(dtChecks.Rows[i]["ID"].ToString()), Convert.ToInt32(dtChecks.Rows[i]["AutoID"].ToString()));
#endregion
DBHelper.UpdateCurrentStockCCGC(cmd, dtChecks.Rows[i]["cInvCode"].ToString(), dtChecks.Rows[i]["cWhCode"].ToString(), dtChecks.Rows[i]["cBatch"].ToString(), Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()), string.IsNullOrWhiteSpace(dtChecks.Rows[i]["iNum"].ToString()) ? 0 : Convert.ToDecimal(dtChecks.Rows[i]["iNum"].ToString()), dtChecks.Rows[i]["cFree1"].ToString(),
dtChecks.Rows[i]["cFree2"].ToString(), dtChecks.Rows[i]["cFree3"].ToString(), dtChecks.Rows[i]["cFree4"].ToString(), dtChecks.Rows[i]["cFree5"].ToString(), dtChecks.Rows[i]["cFree6"].ToString(), dtChecks.Rows[i]["cFree7"].ToString(), dtChecks.Rows[i]["cFree8"].ToString(), dtChecks.Rows[i]["cFree9"].ToString(), dtChecks.Rows[i]["cFree10"].ToString(),
"", key, "", "", "", "", 0, 0, -Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()), string.IsNullOrWhiteSpace(dtChecks.Rows[i]["iNum"].ToString()) ? 0 : -Convert.ToDecimal(dtChecks.Rows[i]["iNum"].ToString()), 0, 0, 0, 0, Convert.ToInt32(dtChecks.Rows[i]["ID"].ToString()), Convert.ToInt32(dtChecks.Rows[i]["AutoID"].ToString()));
//回写fOutQuantityy
// sql = @"Update CurrentStock set fOutQuantity=isnull(fOutQuantity,0)-" + Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()) + @"
// where cInvCode='" + dtChecks.Rows[i]["cInvCode"].ToString() + "' and cWhCode='" + dtChecks.Rows[i]["cWhCode"].ToString() + "' ";
@ -870,15 +877,15 @@ isnull(b.cFree10,'') as cFree10
//if (head.UpdateTodoQuantity == true)
//{
#region 判断现存量是否足够
sql = @"IF EXISTS(SELECT AutoID FROM dbo.CurrentStock WHERE iQuantity<0 OR iNum<0 OR fOutQuantity<0)
BEGIN
DECLARE @MSG NVARCHAR(100)
SELECT @MSG='ERP待出库数量不足AutoID'+CAST(AutoID AS NVARCHAR(100)) FROM dbo.CurrentStock WHERE iQuantity<0 OR iNum<0 OR fOutQuantity<0
RAISERROR(@MSG,16,1)
END";
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
// sql = @"IF EXISTS(SELECT AutoID FROM dbo.CurrentStock WHERE iQuantity<0 OR iNum<0 OR fOutQuantity<0)
// BEGIN
// DECLARE @MSG NVARCHAR(100)
// SELECT @MSG='ERP待出库数量不足!AutoID:'+CAST(AutoID AS NVARCHAR(100)) FROM dbo.CurrentStock WHERE iQuantity<0 OR iNum<0 OR fOutQuantity<0
// RAISERROR(@MSG,16,1)
// END";
// cmd.CommandText = sql;
// cmd.ExecuteNonQuery();
#endregion
}

1
ICSSoft.ERP.WebAPI/ICSSoft.DataProject/TransferDoc.cs

@ -1076,7 +1076,6 @@ isnull(b.cFree10,'') as cFree10
,0,0
FROM ST_AppTransVouch
WHERE cTVCode='" + head.TACode + @"'
";
cmd.Parameters.Clear();
cmd.Parameters.Add(new SqlParameter("@ID", iFather));

6
ICSSoft.ERP.WebAPI/ICSSoft.ERP.WebAPI/Web.config

@ -39,15 +39,15 @@
<!--其他出库 ,收发类别名称~单据编号对应名称~ID获取对应参数-->
<add key="BrrowCRDNAME" value="其他出库~其他出库单~rd"/>
<add key="BrrowCRDNAME" value="试用出库~其他出库单~rd"/>
<!--其他出库 ,收发类别名称~单据编号对应名称~ID获取对应参数-->
<add key="OtherOutCRDNAME" value="其他出库~其他出库单~rd"/>
<add key="OtherOutCRDNAME" value="试用出库~其他出库单~rd"/>
<!--形态转换 ,单据编号对应名称~ID获取对应参数~收发类别名称~收发类别名称~收发类别名称~收发类别名称~ID获取对应参数-->
<add key="AssemCRDNAME" value="转换入库~转换出库~形态转换单~as~其他入库单~其他出库单~rd"/>
<!--拆卸 ,收发类别名称~收发类别名称~收发类别名称~收发类别名称~ID获取对应参数-->
<add key="DisaRCRDNAME" value="生产入库~其他入库单~销售出库~其他出库单~rd"/>
<!--成品入库 ,收发类别名称~单据编号对应名称~ID获取对应参数-->
<add key="ManuFaCRDNAME" value="生产入库~产成品入库单~rd"/>
<add key="ManuFaCRDNAME" value="生产完工入库~产成品入库单~rd"/>
<!--生产发退材料单,收发类别名称~单据编号对应名称~ID获取对应参数-->
<add key="MoICRDNAME" value="生产领料~材料出库单~rd"/>
<!--委外发退料,收发类别名称~单据编号对应名称~ID获取对应参数-->

3
ICSSoft.ERP.WebAPI/ICSSoft.Entity/ICSPurchaseReceiveDoc.cs

@ -12,7 +12,8 @@ namespace ICSSoft.Entity
public string User;//操作人
public DateTime MTime;//操作时间
public string VenCode;//供应商编号
public bool UpdateStock;
public bool UpdateStock;//是否更新现存量
public bool UpdateTodoQuantity;//是否更新待出入库数量
public string WHCode;//仓库编号
public string DNCode;//到货单编号
public string POCode;//采购订单号

|||||||
100:0
Loading…
Cancel
Save