1
wtt
2 天以前 807bb9a2b4d6db408ebdded1cff41f3094eac11e
WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -435,7 +435,7 @@
                }
                else
                {
                    if (HProcID == "90")
                    if (HProcID == "90" || HProcID== "102")
                    {
                        DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList2 '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList2");
                        if (dataSet.Tables[0].Rows.Count > 0)
@@ -531,7 +531,7 @@
                    "(HInterID,HEntryID,HBillNo_bak,HSourceBillNo,HSourceInterID,HSourceEntryID,HMaterID" +
                    ",HProdOrgID,HSourceBillType,HAuxPropID,HProcID,HQty,HBatchNo,HBarCode,HMTONo,HPlanMode) " +
                    " values(" + HInterID + "," + (i + 1) + ",'" + HBillNo + "','" + tempList[i].HProcExchBillNo + "'," + tempList[i].HProcExchInterID + "," + tempList[i].HProcExchEntryID + "," + tempList[i].HMaterID +
                    ",'" + HOrgID + "','',0," + HProcID + "," + tempList[i].HQty + ",'"+ tempList[i].HBatchNo + "','" + tempList[i].HBarCode + "','','') ");
                    ",'" + HOrgID + "','',0," + tempList[i].HProcID + "," + tempList[i].HQty + ",'"+ tempList[i].HBatchNo + "','" + tempList[i].HBarCode + "','','') ");
                }
                oCN.Commit();
@@ -619,72 +619,76 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //增加产线组装追溯单
                DataSet ds1 = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + omodel.HProcExchBillNo + "'," + omodel.HProcID, "h_p_Gy_BarCodeBillBomList");
                if (ds1.Tables[0].Rows.Count > 0)
                if (omodel.HProcID!=90)//斯莫尔拍照清洁工序过滤
                {
                    //判配件数量是否等于0
                    for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                    //增加产线组装追溯单
                    DataSet ds1 = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + omodel.HProcExchBillNo + "'," + omodel.HProcID, "h_p_Gy_BarCodeBillBomList");
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        double SYHQty = double.Parse(ds1.Tables[0].Rows[i]["配件数量"].ToString());
                        string HMaterNamePJ = ds1.Tables[0].Rows[i]["配件代码"].ToString();
                        if (SYHQty == 0)
                        //判配件数量是否等于0
                        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "[3791-2-020]配件代码:" + HMaterNamePJ + ",数量为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                            double SYHQty = double.Parse(ds1.Tables[0].Rows[i]["配件数量"].ToString());
                            string HMaterNamePJ = ds1.Tables[0].Rows[i]["配件代码"].ToString();
                            if (SYHQty == 0)
                            {
                                oCN.RollBack();
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "[3791-2-020]配件代码:" + HMaterNamePJ + ",数量为0!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                    }
                    ds1 = oCN.RunProcReturn("select * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID =" + omodel.HProcExchInterID + " and HMainSourceEntryID =" + omodel.HProcExchEntryID + " and HBarCode_P = '" + omodel.HBarCode_P + "'", "Sc_AssemblyBillMain");
                        ds1 = oCN.RunProcReturn("select * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID =" + omodel.HProcExchInterID + " and HMainSourceEntryID =" + omodel.HProcExchEntryID + " and HBarCode_P = '" + omodel.HBarCode_P + "'", "Sc_AssemblyBillMain");
                    if (ds1.Tables[0].Rows.Count == 0)
                    {
                        Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo);
                        string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true);
                        string prefix = omodel.HBarCode_P.Substring(0, 10); // 从索引0开始,截取10个字符 判断每个项目的O星圈配件数量
                        if (ds1.Tables[0].Rows.Count == 0)
                        {
                            Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo);
                            string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true);
                            string prefix = omodel.HBarCode_P.Substring(0, 10); // 从索引0开始,截取10个字符 判断每个项目的O星圈配件数量
                            //保存生产组装单主表
                         string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate
                            string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate
                        ,HBillNo,HBillStatus,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo
                        ,HICMOInterID,HICMOBillNo,HBarCode_P,HMaterID,HUnitID,HAssemblyStatus,HProdOrgID)
                        values('{DateTime.Now.Year}','{DateTime.Now.Month}','3727','3727',{HInterID1},getdate()
                        ,'{HBillNo1}','1','{user}',getdate(),{omodel.HProcExchInterID.ToString()},{omodel.HProcExchEntryID.ToString()},'{omodel.HProcExchBillNo.ToString()}'
                        ,{omodel.HICMOInterID.ToString()},'{omodel.HICMOBillNo.ToString()}','{omodel.HBarCode_P.ToString()}',{omodel.HMaterID},0,'汇报',{omodel.HProdOrgID})";
                        oCN.RunProc(sql);
                        if (prefix == "#0TE911124") {
                            for (int i = 0; i < sub.Count; i++)
                            oCN.RunProc(sql);
                            if (prefix == "#0TE911124")
                            {
                                //子表存储
                             string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
                                for (int i = 0; i < sub.Count; i++)
                                {
                                    //子表存储
                                    string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
                            ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty
                            ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber)
                            values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,''
                            ,'',{sub[i].HMaterID},0,0,0,3
                            ,0,0,getdate(),'{sub[i].HBarCode}','{omodel.HBarCode_P}','') ";
                                oCN.RunProc(sq2);
                                    oCN.RunProc(sq2);
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < sub.Count; i++)
                            else
                            {
                                //子表存储
                                string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
                                for (int i = 0; i < sub.Count; i++)
                                {
                                    //子表存储
                                    string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
                            ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty
                            ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber)
                            values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,''
                            ,'',{sub[i].HMaterID},0,0,0,1
                            ,0,0,getdate(),'{sub[i].HBarCode}','{omodel.HBarCode_P}','') ";
                                oCN.RunProc(sq2);
                                    oCN.RunProc(sq2);
                                }
                            }
                        }
                    }
                }