yangle
2023-05-12 6a373c4ae92c4bf6455dc13ee3c861a0946b612b
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÌõÂëÉú³É/Sc_BarCodeController.cs
@@ -259,6 +259,34 @@
        }
        #endregion
        #region [通过条码编号获取HItemId]
        [Route("Sc_BarCode/Get_HItemId")]
        [HttpGet]
        public object Get_HItemId(string sWhere)
        {
            List<object> columnNameList = new List<object>();
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_IF_BarCodeBillList where æ¡ç ç¼–号 =  '" + sWhere + "'", "h_v_IF_BarCodeBillList");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.Message.ToString();
                objJsonResult.data = null;
                objJsonResult.list = columnNameList;
            }
            return objJsonResult;
        }
        #endregion
        #region [通过选择的源单信息查找源单数据]
        [Route("Sc_BarCode/SelectReportFromBillList")]
        [HttpPost]
@@ -387,6 +415,7 @@
                ordrlist.HPinfan = dt.Rows[i]["HPinfan"].ToString();
                ordrlist.HSourceName = dt.Rows[i]["生产线"].ToString();
                ordrlist.HEndDate = dt.Rows[i]["计划完工日期"].ToString();//博日 ç”Ÿäº§è®¢å• å¤±æ•ˆæ—¥æœŸ
                ordrlist.HMinQty = dt.Rows[i]["最小包装数"].ToString();
                if (HBarCodeType == "仪器外购件条码容器规则")
                {
                    ordrlist.HMinQty = dt.Rows[i]["未生成条码数量"].ToString();
@@ -428,6 +457,14 @@
                ordrlist.HUnitName = dt.Rows[i]["计量单位"].ToString();
                ordrlist.HRemark = dt.Rows[i]["备注"].ToString();
                ordrlist.HMTONo = dt.Rows[i]["计划跟踪号"].ToString();
                if(HSourceBillType == "收料通知单")
                {
                    ordrlist.HFurnaceNO = dt.Rows[i]["炉号"].ToString();
                    ordrlist.HCoilNO = dt.Rows[i]["钢卷捆包号"].ToString();
                    ordrlist.HheatNO = dt.Rows[i]["热处理"].ToString();
                }
                if (HBarCodeType == "仪器外购件条码容器规则")
                {
                    ordrlist.HMinQty = dt.Rows[i]["未生成条码数量"].ToString();
@@ -478,6 +515,73 @@
            return ordrlist;
        }
        #endregion
        #region [同步资料]
        [Route("Sc_BarCode/Sync_data")]
        [HttpGet]
        public object Sync_data()
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            try
            {
                oCn.RunProc("exec h_p_IF_ERPDataToLocal", ref DBUtility.ClsPub.sExeReturnInfo);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "同步基础资料成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "同步基础资料失败!" + e;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region [批次]
        [Route("Sc_BarCode/Batch")]
        [HttpGet]
        public object Batch(int HMaterID, string HBatchNo)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            bool b = false;
            if (HMaterID != 0)
            {
                DataSet oDs = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_GetBatchNo " + HMaterID.ToString() + ",'" + HBatchNo + "','" + "" + "','" + "" + "'", "h_p_Gy_BarCodeBill_GetBatchNo");
                //
                if (oDs == null && oDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "1";
                    objJsonResult.Message="生成批次失败!";
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0][0]) == "1")
                {
                    objJsonResult.code = "1";
                    objJsonResult.Message = "生成批次成功!";
                    objJsonResult.data = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
                    HBatchNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
                    b = true;
                    return objJsonResult;
                }
            }
            //明细表是否为零行
            if (b == false)
            {
                objJsonResult.code = "1";
                objJsonResult.Message="没有需要生成批次的明细行!";
                return objJsonResult;
            }
            else //完全封闭
            {
                return null;
            }
        }
        #endregion
        #region [条码生成接口]
@@ -536,7 +640,7 @@
            }
            return objJsonResult;
        }
        #endregion
        #endregion
        #region[单据完整性判断]
        private bool Sub_AllowSave(string msg2, string HSelectBarCodeType)
@@ -613,6 +717,13 @@
            int k = 0;
            int n = 0;                  //同一批生成条码中的第几条
            string sTMNumber = "";      //条码自定义前缀
            string HCoilNO = "";
            string HFurnaceNO = "";
            string HFactory = "";
            decimal HAuxQty = 0;
            string HheatNO = "";
            DataSet Ds;
            msg2 = msg2.Replace("\\", "");
            msg2 = msg2.Replace("\n", "");  //\n
@@ -625,6 +736,12 @@
                    HNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HMaterID);
                    HMaterNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HMaterNumber);
                    HBatchNo = ClsPub.isStrNull(ordrlist[j].HBatchNo);
                    HCoilNO = ClsPub.isStrNull(ordrlist[j].HCoilNO);
                    HFurnaceNO = ClsPub.isStrNull(ordrlist[j].HFurnaceNO);
                    HFactory = ClsPub.isStrNull(ordrlist[j].HFactory);
                    HAuxQty = ClsPub.isLong(ordrlist[j].HAuxQty);
                    HheatNO = ClsPub.isStrNull(ordrlist[j].HheatNO);
                    //日期获取方式
                    sDate = DateTime.Now.ToString();
                    //
@@ -895,6 +1012,12 @@
                        barcode.HInnerBillNo2 = ordrlist[j].HInnerBillNo;
                        barcode.HMaker2 = ordrlist[j].HMaker;
                        barcode.HGiveAwayFlag2 = ordrlist[j].HGiveAwayFlag;
                        barcode.HCoilNO = ordrlist[j].HCoilNO;
                        barcode.HFurnaceNO = ordrlist[j].HFurnaceNO;
                        barcode.HFactory = ordrlist[j].HFactory;
                        barcode.HAuxQty = ordrlist[j].HAuxQty;
                        barcode.HheatNO = ordrlist[j].HheatNO;
                        ListRows.Add(barcode);
                        k = k + 1;
                        n = n + 1;
@@ -935,6 +1058,14 @@
            string HInnerBillNo = "";
            bool HGiveAwayFlag = false;
            Int64 HEntryID = 0;
            string HCoilNO2 = "";
            string HFurnaceNO2 = "";
            string HFactory2 = "";
            decimal HAuxQty2 = 0;
            string HheatNO2 = "";
            DateTime HProduceDate;
            DateTime HExpiryDate;
            try
            {
                oCN.BeginTran();
@@ -979,6 +1110,14 @@
                        HSeOrderBillNo = ClsPub.isStrNull(ListRows[i].HSeOrderBillNo2);
                        HInnerBillNo = ClsPub.isStrNull(ListRows[i].HInnerBillNo2);
                        HGiveAwayFlag = ClsPub.isBool(ListRows[i].HGiveAwayFlag2);
                        HCoilNO2 = ClsPub.isStrNull(ListRows[i].HCoilNO);
                        HFurnaceNO2 = ClsPub.isStrNull(ListRows[i].HFurnaceNO);
                        HFactory2 = ClsPub.isStrNull(ListRows[i].HFactory);
                        HAuxQty2 = ClsPub.isLong(ListRows[i].HAuxQty);
                        HheatNO2 = ClsPub.isStrNull(ListRows[i].HheatNO);
                        HProduceDate = ClsPub.isDate(ListRows[i].HProduceDate);
                        HExpiryDate = ClsPub.isDate(ListRows[i].HExpiryDate);
                        oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
@@ -986,7 +1125,8 @@
                                    ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
                                    ",HGiveAwayFlag " +
                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
                                    ",HCoilNO,HFurnaceNO,HFactory,HAuxQty,HheatNO,HProduceDate,HExpiryDate " +
                                    ") values ("
                                    + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                                    + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
@@ -995,7 +1135,7 @@
                                    + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
                                    + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() + ""
                                    + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','" + HCoilNO2 + "','" + HFurnaceNO2 + "','" + HFactory2 + "'," + HAuxQty2 + ",'" + HheatNO2 + "','" + HProduceDate + "','" + HExpiryDate + "'" + ")");
                        //HNumber = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterID2Col].Value);