yangle
2025-04-02 5cf903c0d4fa20a502026cd80b83025659345647
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÌõÂëÉú³É/Sc_BarCodeController.cs
@@ -127,6 +127,10 @@
                    list.Add("仪器成品条码规则");
                    list.Add("试剂成品条码规则");
                }
                else if (sCapName == "添康科技")
                {
                    list.Add("批次条码");
                }
                else
                {
                    list.Add("唯一条码");
@@ -232,6 +236,11 @@
                        tabname = "h_v_IF_ProcessExchangeBillList_Source";
                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_ProcessExchangeBillList_Source " + sWhere + " order by å•据号 desc,hsubid", tabname).Tables[0].Rows.Count;
                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by å•据号 desc,hsubid) as HRowNumber,* from h_v_IF_ProcessExchangeBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
                        break;
                    case "销售出库单":
                        tabname = "h_v_IF_SellOutBillList_Source";
                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBillList_Source " + sWhere + " order by å•据号 desc,hsubid", tabname).Tables[0].Rows.Count;
                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by å•据号 desc,hsubid) as HRowNumber,* from h_v_IF_SellOutBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
                        break;
                    default:
                        break;
@@ -349,6 +358,12 @@
                            //写入信息
                            ListRows.Add(HSourceOrderList1(ds.Tables[0], ordrlist, HBarCodeType, HSourceBillType));
                            break;
                        case "1205": //销售出库单
                            //得到信息
                            ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList_BarCode where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_SellOutBillList_BarCode");
                            //写入信息
                            ListRows.Add(HSourceOrderList1(ds.Tables[0], ordrlist, HBarCodeType, HSourceBillType));
                            break;
                        case "1102": //采购订单
                            //得到信息
                            ds = oCN.RunProcReturn("select * from h_v_IF_POOrderList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_POOrderList");
@@ -431,6 +446,7 @@
        public object HSourceOrderList(DataTable dt, HSouceOrderList ordrlist,string HBarCodeType) 
        {
            oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ordrlist.HQty = dt.Rows[i]["未生成条码数量"].ToString();
@@ -467,6 +483,17 @@
                ordrlist.HSourceName = dt.Rows[i]["生产线"].ToString();
                ordrlist.HEndDate = dt.Rows[i]["计划完工日期"].ToString();//博日 ç”Ÿäº§è®¢å• å¤±æ•ˆæ—¥æœŸ
                ordrlist.HMinQty = dt.Rows[i]["最小包装数"].ToString();
                if (oSystemParameter.omodel.WMS_CampanyName == "九菱") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
                    ordrlist.HGroupID = Convert.ToInt32(dt.Rows[i]["HBeginWorkGroupID"]);
                    ordrlist.HGroupNumber = dt.Rows[i]["开工班组代码"].ToString();
                    ordrlist.HGroupName = dt.Rows[i]["开工班组名称"].ToString();
                    ordrlist.HEmpID = Convert.ToInt32(dt.Rows[i]["HBeginWorkEmpID"]);
                    ordrlist.HEmpNumber = dt.Rows[i]["开工人代码"].ToString();
                    ordrlist.HEmpName = dt.Rows[i]["开工人名称"].ToString();
                }
                if (HBarCodeType == "仪器外购件条码容器规则")
                {
                    ordrlist.HMinQty = dt.Rows[i]["未生成条码数量"].ToString();
@@ -566,6 +593,15 @@
                    ordrlist.HSPNumber = dt.Rows[i]["仓位代码"].ToString();
                    ordrlist.HSPName = dt.Rows[i]["仓位"].ToString();
                }
                if(HSourceBillType == "销售出库单")
                {
                    ordrlist.HWhID = dt.Rows[i]["HWhID"].ToString();
                    ordrlist.HWhNumber = dt.Rows[i]["仓库代码"].ToString();
                    ordrlist.HWhName = dt.Rows[i]["仓库"].ToString();
                    //ordrlist.HSPID = dt.Rows[i]["HSPID"].ToString();
                    //ordrlist.HSPNumber = dt.Rows[i]["仓位代码"].ToString();
                    //ordrlist.HSPName = dt.Rows[i]["仓位"].ToString();
                }
            }
            return ordrlist;
        }
@@ -651,13 +687,13 @@
                if (oDs == null && oDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "1";
                    objJsonResult.Message="生成批次失败!";
                    objJsonResult.Message= "[0000-2-053]生成批次失败!";
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0][0]) == "1")
                {
                    objJsonResult.code = "1";
                    objJsonResult.Message = "生成批次成功!";
                    objJsonResult.Message = "[0000-2-054]生成批次成功!";
                    objJsonResult.data = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
                    HBatchNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
                    b = true;
@@ -668,7 +704,7 @@
            if (b == false)
            {
                objJsonResult.code = "1";
                objJsonResult.Message="没有需要生成批次的明细行!";
                objJsonResult.Message= "[3899-2-003]没有需要生成批次的明细行!";
                return objJsonResult;
            }
            else //完全封闭
@@ -709,7 +745,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "选择组织有错误!";
                    objJsonResult.Message = "[0000-2-055]选择组织有错误!";
                    return objJsonResult;
                }
                if (!Sub_AllowSave(msg2, HSelectBarCodeType))//单据完整性判断
@@ -730,7 +766,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "条码生成失败!"+e.Message;
                objJsonResult.Message = "[3899-2-006]条码生成失败!" + e.Message;
                return objJsonResult;
            }
            return objJsonResult;
@@ -763,7 +799,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "条码生成完整性判断错误";
                        objJsonResult.Message = "[3899-2-007]条码生成完整性判断错误";
                        return false;
                    }
                    else if (DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0][0]) == "1")
@@ -821,6 +857,9 @@
            Int64 HGroupID = 0;
            long HEmpID = 0;
            string HCusModel = ""; //客户物料规格
            string HCusMaterName = ""; //客户物料名称
            string HCheckEmpName = ""; //检验员名称
            DataSet Ds;
            msg2 = msg2.Replace("\\", "");
@@ -842,6 +881,9 @@
                    HheatNO = ClsPub.isStrNull(ordrlist[j].HheatNO);
                    HGroupID = ClsPub.isInt(ordrlist[j].HGroupID);
                    HEmpID = ClsPub.isLong(ordrlist[j].HEmpID);
                    HCusModel = ClsPub.isStrNull(ordrlist[j].HCusModel);
                    HCusMaterName = ClsPub.isStrNull(ordrlist[j].HCusMaterName);
                    HCheckEmpName = ClsPub.isStrNull(ordrlist[j].HCheckEmpName);
                    //日期获取方式
                    sDate = DateTime.Now.ToString();
                    //
@@ -854,6 +896,10 @@
                        sDate = DBUtility.ClsPub.isStrNull(ordrlist[j].HEndDate);
                    }
                    else if (CampanyName == "夏宝电器")// æ—¥æœŸï¼šç”Ÿäº§è®¢å• æ¡ç æ—¥æœŸ
                    {
                        sDate = DBUtility.ClsPub.isStrNull(ordrlist[j].HDate);
                    }
                    else if (CampanyName == "九菱")// æ—¥æœŸï¼šç”Ÿäº§è®¢å• æ¡ç æ—¥æœŸ
                    {
                        sDate = DBUtility.ClsPub.isStrNull(ordrlist[j].HDate);
                    }
@@ -1191,6 +1237,9 @@
                        barcode.HGroupID2 = ordrlist[j].HGroupID;
                        barcode.HEmpID2 = ordrlist[j].HEmpID;
                        barcode.HCusModel2 = ordrlist[j].HCusModel;
                        barcode.HCusMaterName2 = ordrlist[j].HCusMaterName;
                        barcode.HCheckEmpName2 = ordrlist[j].HCheckEmpName;
                        ListRows.Add(barcode);
                        k = k + 1;
                        n = n + 1;
@@ -1240,6 +1289,9 @@
            DateTime HProduceDate;
            DateTime HExpiryDate;
            long HEmpID2 = 0;
            string HCusModel2 = "";
            string HCusMaterName2 = "";
            string HCheckEmpName2 = "";
            try
            {
@@ -1255,6 +1307,10 @@
                        if (CampanyName == "博日科技" || CampanyName == "夏宝电器")
                        {
                            HBarCodeType = "唯一条码";
                        }
                        if (CampanyName == "九菱")
                        {
                            HBarCode = HBarCode + ClsPub.isStrNull(ListRows[i].HMTONo2);
                        }
                        //
                        HMaterID = ClsPub.isLong(ListRows[i].HMaterID2);
@@ -1295,6 +1351,9 @@
                        HExpiryDate = ClsPub.isDate(ListRows[i].HExpiryDate);
                        HGroupID2 = ClsPub.isInt(ListRows[i].HGroupID2);
                        HEmpID2 = ClsPub.isLong(ListRows[i].HEmpID2);
                        HCusModel2 = ClsPub.isStrNull(ListRows[i].HCusModel2);
                        HCusMaterName2 = ClsPub.isStrNull(ListRows[i].HCusMaterName2);
                        HCheckEmpName2 = ClsPub.isStrNull(ListRows[i].HCheckEmpName2);
                        oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
@@ -1303,7 +1362,7 @@
                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
                                    ",HGiveAwayFlag " +
                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
                                    ",HCoilNO,HFurnaceNO,HFactory,HAuxQty,HheatNO,HProduceDate,HExpiryDate,HEmpID " +
                                    ",HCoilNO,HFurnaceNO,HFactory,HAuxQty,HheatNO,HProduceDate,HExpiryDate,HEmpID,HCusModel,HCusMaterName,HCheckEmpName " +
                                    ") values ("
                                    + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                                    + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID2.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
@@ -1312,7 +1371,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 + "','" + HCoilNO2 + "','" + HFurnaceNO2 + "','" + HFactory2 + "'," + HAuxQty2 + ",'" + HheatNO2 + "','" + HProduceDate + "','" + HExpiryDate + "'," + HEmpID2.ToString() + ")");
                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','" + HCoilNO2 + "','" + HFurnaceNO2 + "','" + HFactory2 + "'," + HAuxQty2 + ",'" + HheatNO2 + "','" + HProduceDate + "','" + HExpiryDate + "'," + HEmpID2.ToString() + ",'" + HCusModel2 + "','" + HCusMaterName2 + "','" + HCheckEmpName2 + "'" + ")");
                        //HNumber = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterID2Col].Value);
@@ -1374,7 +1433,7 @@
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取资源绑定数据成功!";
                    objJsonResult.Message = "[0000-1-037]获取资源绑定数据成功!";
                    objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }));  //序列化DataSet中的时间格式,然后再反序列化回来
                    objJsonResult.list = listobj;
                    return objJsonResult;
@@ -1383,7 +1442,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有返回任何结果,条码不存在!";
                    objJsonResult.Message = "[0000-2-020]没有返回任何结果,条码不存在!";
                    objJsonResult.data = null;
                    objJsonResult.list = listobj;
                    return objJsonResult;
@@ -1394,7 +1453,7 @@
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "条码生成失败!" + e.Message;
                objJsonResult.Message = "[3899-2-006]条码生成失败!" + e.Message;
                return objJsonResult;
            }
        }