chenhaozhe
4 天以前 291fdb29daf239a13fcfb3f5e08a2f5bf9167534
WebAPI/Controllers/CJGL/Cj_CheckBarcodeController.cs
@@ -22,11 +22,11 @@
        #region 三码合一,判断扫描物料条码绑定信息是否一致
        [Route("CheckBarcodeController/Get_BarCode_BarcodeCheck")]
        [HttpGet]
        public object CheckBarcode(string HBarCode_Pallet, string HBarCode_Destination, string HBarCode_MiddleBox, string HBarCode_SN, int HBarCodeType,int HInterID, string HBillNo,string HMaker)
        public object CheckBarcode(string HBarCode_Pallet, string HBarCode_Destination, string HBarCode_MiddleBox, string HBarCode_SN, int HBarCodeType, int HInterID, string HBillNo, string HMaker, string HBillType)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_Cj_CheckBarcodeBing '" + HBarCode_Pallet + "','" + HBarCode_Destination + "','" + HBarCode_MiddleBox + "','" + HBarCode_SN + "','" + HBarCodeType + "'," + HInterID + ",'" + HBillNo + "','" + HMaker + "'", "h_p_Cj_CheckBarcodeBing");
                ds = oCn.RunProcReturn("exec h_p_Cj_CheckBarcodeBing '" + HBarCode_Pallet + "','" + HBarCode_Destination + "','" + HBarCode_MiddleBox + "','" + HBarCode_SN + "','" + HBarCodeType + "'," + HInterID + ",'" + HBillNo + "','" + HMaker + "','" + HBillType + "'", "h_p_Cj_CheckBarcodeBing");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -68,15 +68,15 @@
        [Route("CheckBarcodeController/Save_BarCode_BarcodeCheck")]
        [HttpGet]
        public object Save_BarCode_BarcodeCheck(Int64 HInterID, string HBillNo)
        public object Save_BarCode_BarcodeCheck(Int64 HInterID, string HBillNo, string HBillType)
        {
            try
            {
                oCn.BeginTran();
                DataSet ds = oCn.RunProcReturn("exec h_p_WMS_BarCodeBingCheckBill_Insert " + HInterID.ToString() + ",'" + HBillNo + "'", "h_p_WMS_BarCodeBingCheckBill_Insert");
                DataSet ds = oCn.RunProcReturn("exec h_p_WMS_BarCodeBingCheckBill_Insert " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'", "h_p_WMS_BarCodeBingCheckBill_Insert");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
@@ -93,7 +93,7 @@
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //失败!
                        objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString();  //失败!
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -122,5 +122,140 @@
        }
        #endregion
        #region 拆箱小卫
        [Route("CheckBarcodeController/UnpackMiddleBox")]
        [HttpGet]
        public object UnpackMiddleBox(string HBarCode_Middle, int signal, string HMaker, string HDate)
        {
            try
            {
                if (signal == 1)//扫码
                {
                    DataSet ds = oCn.RunProcReturn("select a.HCaseCode 中箱码,a.HBarCode 对应的SN码,b.HNumber 物料代码,b.HName 物料名称 from Gy_CaseCodeRelation a left join Gy_Material b on a.HMaterID=b.HItemID where HCaseCode='" + HBarCode_Middle + "'", "Gy_CaseCodeRelation");
                    if (ds.Tables[0].Rows[0]["中箱码"].ToString() == "" || ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "条码不存在!请检查是否装箱";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                else
                {
                    oCn.BeginTran();
                    oCn.RunProc("delete from Gy_CaseCodeRelation where HCaseCode='" + HBarCode_Middle + "'");
                    DataSet dss = oCn.RunProcReturn("select * from Gy_BarCodeBill where HBarCode=' " + HBarCode_Middle + "'", "Gy_BarCodeBill");
                    if (dss != null && dss.Tables.Count > 0)
                    {
                        oCn.RunProc("delete from Gy_BarCodeBill where HBarCode='" + HBarCode_Middle + "'");
                    }
                    oCn.RunProc("insert into System_log VALUES('" + HDate + "','" + HMaker + "',''," + "'小卫拆箱条码" + HBarCode_Middle + "'," + "'APP-中箱码拆箱'" + ",''," + "'删除条码')");
                    oCn.Commit();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "错误请联系管理员";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region sn装箱小卫
        [Route("CheckBarcodeController/PackedBoxSn")]
        [HttpGet]
        public object PackedBoxSn(string HBarCode, string HMaker, string HDate)
        {
            try
            {
                DataSet ds = oCn.RunProcReturn("select a.HBarCode sn码,a.HItemID,b.Hname 物料名称,b.hnumber 物料代码 from Gy_BarCodeBill a LEFT JOIN Gy_Material b on a.hmaterid=b.hitemid where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill");
                if(ds.Tables[0].Rows.Count==0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "该sn码不存在,请检查!!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DataSet dss = oCn.RunProcReturn("select * from Gy_CaseCodeRelation where HBarCode='" + HBarCode + "'", "Gy_CaseCodeRelation");
                int counts=dss.Tables[0].Rows.Count;
                if (counts > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "该sn码已经装箱,请检查!!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region sn装箱小卫提交
        [Route("CheckBarcodeController/submitPackedBoxSn")]
        [HttpGet]
        public object submitPackedBoxSn(string HItemIDs, string HMaker, string HDate)
        {
            try
            {
                DataSet ds = oCn.RunProcReturn("exec h_p_Gy_CaseCodeBySN  '"+ HItemIDs+ "'", "h_p_Gy_CaseCodeBySN");
                if (ds.Tables[0].Rows[0]["HBack"] == "2")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "中箱码已存在请重新生成";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}