ch
2022-01-02 497807c8f2bf240703c8e899327d78a66fcc1f4d
WebAPI/Controllers/²©ÈÕ×Ô¶¯É¨ÂëÏß/ScanlineAPIController.cs
@@ -78,7 +78,7 @@
                ScanLineCode list = js.Deserialize<ScanLineCode>(msg.ToString());    //将json数据转化为对象类型并赋值给list
                if (list.billno != "" && list.billno != null)  //任务单号,非必须,非空则校验barcodes里barcode是否由此任务单制作生成的
                {
                    ds = oCN.RunProcReturn("Select HBarCode barcode from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim()+"'  Order by HItemID ", "Gy_BarCodeBill");
                    ds = oCN.RunProcReturn("Select HBarCode barcode,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim()+"'  Order by HItemID ", "Gy_BarCodeBill");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.status = -1;
@@ -108,6 +108,14 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("Select * from Gy_BarCodeBill where HBarCode='" + list.packagebarcode.ToString().Trim() + "' and HStopflag='1'", "Gy_BarCodeBill");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.status = -1;
                    objJsonResult.msg = "此箱条码已作废";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Models.ClsSc_PackUnionBillMain oItem = new ClsSc_PackUnionBillMain();
                oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
@@ -120,7 +128,7 @@
                oItem.HCheckItemNowID = 0;
                oItem.HCheckItemNextID = 0;
                oItem.HCheckFlowID = 0;
                oItem.HRemark = "自动包装线生辰箱条码";
                oItem.HRemark = "自动包装线生成箱条码";
                oItem.HBacker = "";
                oItem.HBackDate = "";
                oItem.HMaker = "";
@@ -219,14 +227,43 @@
        {
            try
            {
                //判断是否入库
                ds = oCN.RunProcReturn("select * from Sc_ScanLineInStock where HBarCode_Pack='" + packagebarcode + "'", "Sc_ScanLineInStock");
                if (ds!= null && ds.Tables[0].Rows.Count>0)
                {
                    objJsonResult.status = -1;
                    objJsonResult.msg = "该箱条码已入库不允许取消!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("Select 1 from Gy_BarCodeBill where HBarCode='" + packagebarcode.ToString().Trim() + "'", "Gy_BarCodeBill");
                if (ds == null && ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.status = -1;
                    objJsonResult.msg = "无效箱条码";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("Select 1 from Gy_BarCodeBill where HBarCode='" + packagebarcode.ToString().Trim() + "' and HStopflag='1'", "Gy_BarCodeBill");
                if (ds != null && ds.Tables[0].Rows.Count>0)
                {
                    objJsonResult.status = -1;
                    objJsonResult.msg = "此箱条码已作废";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //
                oCN.BeginTran();
                //删除SUM主表
                oCN.RunProc("Delete From Sc_PackUnionBillSub_Sum  where HBarCode_Pack='" + packagebarcode.ToString() + "'");
                //删除子表
                oCN.RunProc("Delete From Sc_PackUnionBillSub  where HBarCode_Pack=" + packagebarcode.ToString());
                oCN.RunProc("Delete From Sc_PackUnionBillSub  where HBarCode_Pack='"+ packagebarcode.ToString() + "'");
                //删除主表
                oCN.RunProc("Delete From Sc_PackUnionBillMain  where HBarCode_Pack=" + packagebarcode.ToString());
                oCN.RunProc("Delete From Sc_PackUnionBillMain  where HBarCode_Pack='" + packagebarcode.ToString() + "'");
                //作废条码档案表
                oCN.RunProc("Update  Gy_BarCodeBill set HStopflag='1'  where HBarCode=" + packagebarcode.ToString());
                oCN.RunProc("Update  Gy_BarCodeBill set HStopflag='1'  where HBarCode='"+ packagebarcode.ToString()+ "'");
                oCN.Commit();