| | |
| | | { |
| | | try |
| | | { |
| | | ds = oCn.RunProcReturn("select * from Gy_BarCodeBill where HBarcode='" + HBarCode + "'", "Gy_BarCodeBill"); |
| | | if (ds.Tables[0].Rows.Count == 0) { |
| | | DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); |
| | | string sErrMsg = ""; |
| | | oSystemParameter.ShowBill(ref sErrMsg); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æå·æ¯è«å°") |
| | | { |
| | | if (!dal.GetInfoByNumber(HBarCode)) |
| | | { |
| | | //æ¡ç è§£æ |
| | | string[] str = HBarCode.Split('@'); |
| | | |
| | | if (str[0] != "CMR" && str[0] != "SRM") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¡ç è§£æå¤±è´¥,请确认æ¡ç æ¯å¦æ£ç¡®!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | int HOrgIDs = 0; |
| | | //æ¥è¯¢ç»ç» |
| | | DataSet ds = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + str[1] + "' ", "Xt_ORGANIZATIONS"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¡ç è§£æå¤±è´¥,请确认æ¡ç ç»ç»æ¯å¦æ£ç¡®!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | HOrgIDs = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString()); |
| | | } |
| | | |
| | | string HMaterNames = ""; |
| | | string HMaterModels = ""; |
| | | string HMaterIDs = "0"; |
| | | //æ¥è¯¢ç©æ |
| | | ds = oCn.RunProcReturn("select * from Gy_Material where HNumber='" + str[4] + "' and HUSEORGID=" + HOrgIDs, "Gy_Material"); |
| | | |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¡ç è§£æå¤±è´¥,请确认æ¡ç ç©ææ¯å¦æ£ç¡®!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | HMaterIDs = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | HMaterNames = ds.Tables[0].Rows[0]["HName"].ToString(); |
| | | HMaterModels = ds.Tables[0].Rows[0]["HModel"].ToString(); |
| | | |
| | | } |
| | | string HSupIDs = "0"; |
| | | //æ¥è¯¢ä¾åºå |
| | | ds = oCn.RunProcReturn("select * from Gy_Supplier where HNumber='" + str[2] + "' and HUSEORGID=" + HOrgIDs, "Gy_Supplier"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | //sErrMsg = "æ¡ç è§£æå¤±è´¥,请确认æ¡ç ä¾åºåæ¯å¦æ£ç¡®!"; |
| | | //return null; |
| | | } |
| | | else |
| | | { |
| | | HSupIDs = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | |
| | | string HSourceInterIDs = "0"; |
| | | string HSourceEntryIDs = "0"; |
| | | string HSourceBillNos = "0"; |
| | | string HUnitIDs = "0"; |
| | | //æ¥è¯¢éè´è®¢å |
| | | ds = oCn.RunProcReturn(@"select a.HInterID,b.HEntryID,a.HBillNo,b.HUnitID from Cg_POOrderBillMain a |
| | | inner join Cg_POOrderBillSub b on a.HInterID = b.HInterID where HBillNo='" + str[3] + "' and b.HMaterID=" + HMaterIDs, "Cg_POOrderBillMain"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | //sErrMsg = "æ¡ç è§£æå¤±è´¥,请确认æ¡ç éè´è®¢åæ¯å¦æ£ç¡®!"; |
| | | //return null; |
| | | } |
| | | else |
| | | { |
| | | HSourceInterIDs = ds.Tables[0].Rows[0]["HInterID"].ToString(); |
| | | HSourceEntryIDs = ds.Tables[0].Rows[0]["HEntryID"].ToString(); |
| | | HSourceBillNos = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | HUnitIDs = ds.Tables[0].Rows[0]["HUnitID"].ToString(); |
| | | } |
| | | |
| | | string HInnerBillNos = ""; |
| | | //æ¥è¯¢å
é¨éè´è®¢åå· |
| | | ds = oCn.RunProcReturn(@" select * from h_v_IF_POInStockList where éè´è®¢åå·= '" + str[3] + "' ", "h_v_IF_POInStockList"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | //sErrMsg = "æ¡ç è§£æå¤±è´¥,请确认æ¡ç å
é¨éè´è®¢åå·æ¯å¦æ£ç¡®!"; |
| | | //return null; |
| | | HInnerBillNos = str[3]; |
| | | } |
| | | else |
| | | { |
| | | HInnerBillNos = ds.Tables[0].Rows[0]["å
é¨éè´è®¢åå·"].ToString(); |
| | | } |
| | | double HQty = double.Parse(str[6]); |
| | | |
| | | //æ¥æè·åæ¹å¼ |
| | | string sDate = DateTime.Now.ToString(); |
| | | string HWei = "0"; //å°¾æ° |
| | | string HBarCodeType = "æ¹æ¬¡æ¡ç "; |
| | | Int64 HMaterID = int.Parse(HMaterIDs); |
| | | Int64 HAuxPropID = 0; |
| | | Int64 HUnitID = int.Parse(HUnitIDs); |
| | | double HQty2 = HQty; |
| | | string HBatchNo2 = str[5]; |
| | | Int64 HSupID = int.Parse(HSupIDs); |
| | | Int64 HGroupID = 0; |
| | | int HPrintQty = 0; |
| | | Int64 HSourceInterID = int.Parse(HSourceInterIDs); |
| | | Int64 HSourceEntryID = int.Parse(HSourceEntryIDs); |
| | | string HSourceBillNo = HSourceBillNos; |
| | | //HSourceBillType = "1102"; |
| | | Int64 HBarcodeNo = 0; //æå· |
| | | Int64 HBarcodeQtys = 0; //æ»ææ° |
| | | Int64 HDeptID = 0; |
| | | //Int64 HWhID = 0; |
| | | //Int64 HSPID = 0; |
| | | string HRemark = "æ¡ç è§£æ"; |
| | | string HMaterName = HMaterNames; |
| | | string HMaterModel = HMaterModels; |
| | | string HPinfan = ""; |
| | | string HMTONo = ""; |
| | | Int64 HCusID = 0; |
| | | string HCusType = ""; |
| | | DateTime HEndDate = DateTime.Now; |
| | | string HWorkLineName = ""; |
| | | string HSeOrderBillNo = ""; |
| | | string HInnerBillNo = HInnerBillNos; |
| | | bool HGiveAwayFlag = false; |
| | | Int64 HEntryID = 1; |
| | | Int64 HInterIDs = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | int HOrgID = HOrgIDs; |
| | | string HSourceBillType = ""; |
| | | |
| | | |
| | | oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + |
| | | ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + |
| | | ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + |
| | | ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + |
| | | ",HGiveAwayFlag " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" + |
| | | ",HProduceDate,HExpiryDate " + |
| | | ") values (" |
| | | + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() |
| | | + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString() |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'" |
| | | + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + ",0,0,'" + HRemark + "'" |
| | | + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'" |
| | | + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterIDs.ToString() + "," + HEntryID.ToString() + "" |
| | | + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag) |
| | | + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','','')"); |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MaterToSource " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "','" + HMaker + "'", "h_p_WMS_AddBarCode_MaterToSource"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |