yusijie
2023-11-15 33cfe29fcdd731c3c759dcae74bdcfaeecd309ea
WebAPI/Controllers/Éú²ú¹ÜÀí/Éú²úÈÎÎñµ¥/Sc_ICMOBillController.cs
@@ -450,7 +450,7 @@
                ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_ICMOBillList");
                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
                if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_ICMOBillMain   
@@ -464,6 +464,12 @@
                    ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
                    "," + HCenterID + ",0,0,0,0," + HBomID + ",'',''" +
                    ",'"+ HIsStockQty + "','"+ HRemark3 + "') ");
                    //反写销售订单数据
                    ClsSc_ICMOBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ICMOBillSub>(msg3);
                    string sql = "update Xs_SeOrderBillSub set HRelationQty_ICMO = ISNULL(HRelationQty_ICMO,0) + " + (oSub.HQty == null ? 0 : oSub.HQty) + " where HInterID = " + mainList[0].HSeOrderInterID + " and HEntryID = "+ mainList[0].HSeOrderEntryID;
                    oCN.RunProc(sql);
                    LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增生产订单单据:" + HBillNo);
                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "新增生产订单单据:" + HBillNo + "','LMES-生产订单模块','" + DBUtility.ClsPub.IPAddress + "','新增单据'", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -488,6 +494,16 @@
                    //删除子表
                    oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'");
                    //反写销售订单数据
                    ClsSc_ICMOBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ICMOBillSub>(msg3);
                    string sql = "update Xs_SeOrderBillSub set " +
                        "HRelationQty_ICMO = ISNULL(HRelationQty_ICMO,0) - " + ds.Tables[0].Rows[0]["销售数量"] + " +  " + (oSub.HQty == null ? 0 : oSub.HQty) + "" +
                        " where HInterID = " + mainList[0].HSeOrderInterID + " and HEntryID = " + mainList[0].HSeOrderEntryID;
                    oCN.RunProc(sql);
                    LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改生产订单单据:" + HBillNo);
                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "修改生产订单单据:" + HBillNo + "','LMES-生产订单模块','" + DBUtility.ClsPub.IPAddress + "','修改单据'", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -570,14 +586,14 @@
                ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
                ,HBomID,HEntryCusID,HSTOCKINORGID
            ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
                ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark,HCusMaterName,HCusModel)
                ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark,HCusMaterName,HCusModel,HOrderPickRemark)
                 values({HInterID},{HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                ,'{(oSub.HBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HBeginDate.ToString())}','{(oSub.HEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HEndDate.ToString())}'
                ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS}
                 ,{oSub.HBomID}  ,{oSub.HCusID} ,{oSub.HSTOCKINORGID}
                       ,0,0,'','',0,0
                ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}','{oSub.HCusMaterName}','{oSub.HCusModel}')");
                ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}','{oSub.HCusMaterName}','{oSub.HCusModel}','{oSub.HOrderPickRemark}')");
            objJsonResult.code = "1";
            objJsonResult.count = 1;
@@ -1979,5 +1995,44 @@
        }
        #endregion
        #region ç”Ÿäº§ä»»åŠ¡å•è®¢å•åŒ…è£…å¤‡æ³¨ ä¿å­˜åŠŸèƒ½
        [Route("Sc_ICMOBill/ICMOBillSaveRemark")]
        [HttpGet]
        public object ICMOBillSaveRemark(string HInterID,string HEntryID, string HOrderPickRemark)
        {
            try
            {
                if (string.IsNullOrEmpty(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "Exception!HInterID不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                oCN.BeginTran();
                 oCN.RunProc("update Sc_ICMOBillSub set HOrderPickRemark = '" + HOrderPickRemark + "' where HInterID = " + HInterID + " and  HEntryID = " + HEntryID + "");
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}