yusijie
2025-09-13 f989e2e3dfb3866b5d9fe271f69c728eb5be242d
条码生成添加工号,条码日期,流水号获取方式调整;
3个文件已修改
24 ■■■■■ 已修改文件
WebAPI/Controllers/MaterialHandingController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/MaterialHandingController.cs
@@ -273,12 +273,12 @@
        #region 物料校验
        [Route("MaterialHandingController/CheckMaterial")]
        [HttpGet]
        public object CheckMaterial(string HMaterID, string user, int param,string OrganizationID)
        public object CheckMaterial(string HMaterID, string user, int param,string OrganizationID,string SupID)
        {
            try
            {
                //ds1获取的sql后期记得改回供应商,修改人->供应商
                var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 物料代码='" + HMaterID + "'" + "and 创建人='" + user + "'", "h_v_Gy_UserMaterRelationEdit");
                var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 物料代码='" + HMaterID + "'" + "and 供应商代码='" + SupID + "'", "h_v_Gy_UserMaterRelationEdit");
                var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + HMaterID+ "'"+ " and HUSEORGID="+"'"+ OrganizationID+"'", "Gy_Material");
                if(ds.Tables[0].Rows.Count == 0)
                {
WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
@@ -137,8 +137,12 @@
                string HKFDate= ls[0].HKFDQDate==null? DateTime.Now.ToString("yyyy/MM/dd"): ls[0].HKFDQDate;//生产日期
                string HKFDate_1 = string.Join("", HKFDate.Split('/').Select(x => x.PadLeft(2, '0')));
                double HMinQty= ls[0].HMinQty;//标准包装数
                string HStatusMan = ls[0].HStatusMan;//工号
                //string HBarCodeDate = ls[0].HBarCodeDate;//工号
                string HBarCodeDate = ls[0].HBarCodeDate == null ? DateTime.Now.ToString("yyyy/MM/dd") : ls[0].HBarCodeDate;//条码日期
                string HBarCodeDate_1 = string.Join("", HBarCodeDate.Split('-').Select(x => x.PadLeft(2, '0')));
                double HBQty= ls[0].HBQty;//最小包装数
                double HBQty = ls[0].HBQty;//最小包装数
                long HISKFPERIOD= ls[0].HISKFPERIOD;//是否启用保质期
                long HBatchManager= ls[0].HBatchManager;//是否启用批号
@@ -161,7 +165,7 @@
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                oCn.BeginTran();
                //Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                Ds = oCn.RunProcReturn("exec GetLSH '" + HSupID+"_"+ HMaterID+"_" + DateTime.Today+ "'", "GetLSH");
                Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HSupID+"_"+ HMaterID+"_" + HBarCodeDate + "'", "GetLSH");
                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                #endregion
@@ -209,7 +213,7 @@
                              : HMinQty;
                            ///供应商名称+@+物料代码+@+物料简称+@+数量+@条码数+@+日期+@+流水号  
                            LSH += 1;
                            TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{currentQty}@{HKFDate_1}@{LSH}";
                            TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{currentQty}@{HBarCodeDate_1}@{LSH}";
                            //TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{oItemSub.biaoqianzhangshu}@{HKFDate_1}@{LSH}";
                            // 添加到生成的条码列表
                            generatedBarcodes.Add(TM);
@@ -239,15 +243,15 @@
                            //               + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
                            sql = "INSERT INTO Gy_BarCodeBill (HInterID, HBarCode, HBarCodeType, HMaterID, HUnitID, HQty, HKFDate, HKFPeriod, HKFDQDate, " +
       "HBatchNo, HBarcodeQtys, HBarcodeNo, HSupID, HGroupID, HMaker, HMakeDate, HPrintQty, HEndQty, HSupflag, " +
       "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD) " +
       "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD,HStatusMan,HBarCodeDate,HinitQty) " +
      "VALUES (" +
       linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + currentQty + ", '" + HKFDate + "', " + HKFPeriod + ", '" + HKFDQDate + "', " +
       "'" + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + ClsPub.CurUserName + "', '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "1" + ", " + "0" + ", 1, " +
       "1, 1, '1', '" + HSourceBillType + "', '1', '" +
       HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ")";
       HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ",'" + HStatusMan + "','" + HBarCodeDate + "','" + currentQty + "'" + ")";
                            LogService.Write("生成条码: " + sql);
                            oCn.RunProc(sql); 
                            oCn.RunProc("exec setLSH '" + HSupID + "_" + HMaterID + "_" + DateTime.Today + "'");
                            oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HSupID + "_" + HMaterID + "_" + HBarCodeDate + "'");
                            virtualCount++;
                           }
@@ -352,7 +356,7 @@
                }
                string inClause = string.Join(",", inValues);
                string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarCode IN ({inClause})";
                string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarCode IN ({inClause})" + " order by 物料代码,cast(流水号 as int)";
                // 直接执行SQL查询
                DataSet ds = oCn.RunProcReturn(sql, "h_v_Gy_UserMaterRelationPrint");
WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs
@@ -50,6 +50,8 @@
        public string HBarCodeType;
        public long HGroupID;
        public string HRemark;
        public string HStatusMan; //惠康工号
        public string HBarCodeDate; //条码日期
        // public ClsGy_MaterialBarCodeBillModel();
    }
}