zzr99
2021-12-14 9b2ce9295586ba04d99f8ae49ce1748e287fa286
新增盘点方案
4个文件已添加
4个文件已修改
1个文件已删除
658 ■■■■■ 已修改文件
DBUtility/业务单据/ClsXt_BaseBillMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LMES/ClsShowMod.cs 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LMES/bin/x86/Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
LMES/bin/x86/奥邦Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/博日自动扫码线/ScanlineAPIController.cs 166 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsSc_PackUnionBill.cs 383 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsSc_PackUnionBillMain.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsSc_PackUnionBillSub.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DBUtility/ÒµÎñµ¥¾Ý/ClsXt_BaseBillMain.cs
@@ -43,5 +43,7 @@
        public Int64 HItemMainID;
        //组织
        public Int64 HPRDORGID;
        //有效状态
        public bool HUseFlag;
    }
}
LMES/ClsShowMod.cs
@@ -3934,6 +3934,12 @@
                        oPt_RadiumCarvingCodeBillList.Show();
                        oMainForm.AddTabPage(oPt_RadiumCarvingCodeBillList);
                        break;
                    case "sc_packunionbill":
                        Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
                        oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
                        oSc_PackUnionBill.ModCaption = gnmc;
                        oSc_PackUnionBill.ShowDialog();
                        break;
                    default:
                        break;
                }
@@ -5728,23 +5734,23 @@
                    //    oSc_PackSplitBillList.Show();
                    //    oMainForm.AddTabPage(oSc_PackSplitBillList);
                    //    break;
                    //case "sc_packunionbill":
                    //    Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
                    //    oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
                    //    oSc_PackUnionBill.ModCaption = gnmc;
                    //    oSc_PackUnionBill.ShowDialog();
                    //    break;
                    //case "sc_packunionbilllist":
                    //    Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
                    //    oSc_PackUnionBillList.MdiParent = oMain;
                    //    oSc_PackUnionBillList.ModCaption = gnmc;
                    //    oSc_PackUnionBillList.Show();
                    //    oMainForm.AddTabPage(oSc_PackUnionBillList);
                    //    break;
                    case "sc_packunionbill":
                        Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
                        oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
                        oSc_PackUnionBill.ModCaption = gnmc;
                        oSc_PackUnionBill.ShowDialog();
                        break;
                    case "sc_packunionbilllist":
                        Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
                        oSc_PackUnionBillList.MdiParent = oMain;
                        oSc_PackUnionBillList.ModCaption = gnmc;
                        oSc_PackUnionBillList.Show();
                        oMainForm.AddTabPage(oSc_PackUnionBillList);
                        break;
                    //===========================MES平板系统单据
@@ -5806,20 +5812,20 @@
                        oMES_StationOutBillList.Show();
                        oMainForm.AddTabPage(oMES_StationOutBillList);
                        break;
                    case "sc_packunionbill":
                        Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
                        oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
                        oSc_PackUnionBill.ModCaption = gnmc;
                        oSc_PackUnionBill.ShowDialog();
                        break;
                    case "sc_packunionbilllist":
                        //权限
                        Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
                        oSc_PackUnionBillList.MdiParent = oMain;
                        oSc_PackUnionBillList.ModCaption = gnmc;
                        oSc_PackUnionBillList.Show();
                        oMainForm.AddTabPage(oSc_PackUnionBillList);
                        break;
                    //case "sc_packunionbill":
                    //    Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
                    //    oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
                    //    oSc_PackUnionBill.ModCaption = gnmc;
                    //    oSc_PackUnionBill.ShowDialog();
                    //    break;
                    //case "sc_packunionbilllist":
                    //    //权限
                    //    Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
                    //    oSc_PackUnionBillList.MdiParent = oMain;
                    //    oSc_PackUnionBillList.ModCaption = gnmc;
                    //    oSc_PackUnionBillList.Show();
                    //    oMainForm.AddTabPage(oSc_PackUnionBillList);
                    //    break;
                    //case "mes_mesbeginworkbill":
                    //    MES_MESBeginWorkBill oMES_MESBeginWorkBill = new MES_MESBeginWorkBill();
                    //    oMES_MESBeginWorkBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
LMES/bin/x86/Debug.rar
Binary files differ
LMES/bin/x86/°Â°îDebug.rar
Binary files differ
WebAPI/Controllers/²©ÈÕ×Ô¶¯É¨ÂëÏß/ScanlineAPIController.cs
@@ -17,6 +17,7 @@
    {
        private jsonScanline objJsonResult = new jsonScanline();
        public DataSet ds = new DataSet();
        public DataSet ds0 = new DataSet();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        #region ç”Ÿæˆç®±ç æŽ¥å£
@@ -66,13 +67,7 @@
        }
        #endregion
        #region æŠ¥å·¥å¹³å°å¼€å·¥å•保存/编辑
        /// <summary>
        /// å¼€å·¥å•
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        #region ç®±æ¡ç ç»‘定关系提交接口
        [Route("packagebarcode/pack")]
        [HttpPost]
        public object pack([FromBody] JObject msg)
@@ -81,6 +76,159 @@
            {
                JavaScriptSerializer js = new JavaScriptSerializer();   //实例化一个能够序列化数据的类
                ScanLineCode list = js.Deserialize<ScanLineCode>(msg.ToString());    //将json数据转化为对象类型并赋值给list
                if (list.billno != "" && list.billno != null)  //任务单号,非必须,非空则校验barcodes里barcode是否由此任务单制作生成的
                {
                    ds = oCN.RunProcReturn("Select HBarCode barcode from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim()+"'  Order by HItemID ", "Gy_BarCodeBill");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.status = -1;
                        objJsonResult.msg = "当前订单无绑定条码!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    List<string> NameList = (from r in ds.Tables[0].AsEnumerable() select r.Field<string>("barcode")).ToList();
                    List<string> NameList1= list.barcodes.Select(t => t.barcode).ToList();
                    var strList = NameList1.Except(NameList).ToList();  //判断提交数据中条码是否存在于订单中
                    if (strList.Count > 0)
                    {
                        string Str=String.Join(",", strList.ToArray());
                        objJsonResult.status = -1;
                        objJsonResult.msg = "条码:"+ Str.ToString()+" ä¸åŒ…含在订单:"+list.billno+"中!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                DLL.ClsSc_PackUnionBill oBill = new DLL.ClsSc_PackUnionBill();
                //判断箱码是否存在
                bool IsBarCodePack = oBill.IsBarCodePack(list.packagebarcode);
                if (IsBarCodePack == false)
                {
                    objJsonResult.status = -1;
                    objJsonResult.msg = "箱码已存在,不能重复绑定!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Models.ClsSc_PackUnionBillMain oItem = new ClsSc_PackUnionBillMain();
                oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                oItem.HBillType = "3783";
                oItem.HBillSubType = "3783";
                oItem.HDate= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                oItem.HBillNo = DBUtility.ClsPub.CreateBillCode(oItem.HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                oItem.HBillStatus = 1;
                oItem.HCheckItemNowID = 0;
                oItem.HCheckItemNextID = 0;
                oItem.HCheckFlowID = 0;
                oItem.HRemark = "自动包装线生辰箱条码";
                oItem.HBacker = "";
                oItem.HBackDate = "";
                oItem.HMaker = "";
                oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                oItem.HChecker = "";
                oItem.HCheckDate = "";
                oItem.HUpDater = "";
                oItem.HUpDateDate = "";
                oItem.HCloseMan = "";
                oItem.HCloseDate = "";
                oItem.HCloseType = false;
                oItem.HDeleteMan = "";
                oItem.HDeleteDate = "";
                oItem.HICMOInterID = 0;
                oItem.HICMOBillNo = "";
                oItem.HBarCode_Pack= list.packagebarcode;
                oItem.HMaterID = 0;
                oItem.HUnitID = 0;
                oItem.HUseFlag =false;   //有效状态
                oBill.omodel = oItem;
                for (int i = 0; i < list.barcodes.Count; i++)
                {
                    //判断条码是否存在
                    bool IsBarCode = oBill.IsBarCodePack(list.barcodes[i].barcode);
                    if (IsBarCodePack == false)
                    {
                        objJsonResult.status = -1;
                        objJsonResult.msg = "条码已存在,不能重复绑定!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    Models.ClsSc_PackUnionBillSub oItemSub = new ClsSc_PackUnionBillSub();
                    ds0 = oCN.RunProcReturn("Select HBarCode,HMaterID,HUnitID,HQty,HSourceID,HGroupID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim() + "' and HBarCode='" + list.barcodes[i].barcode + "'  Order by HItemID ", "Gy_BarCodeBill");
                    oItemSub.HEntryID = i+1;
                    oItemSub.HMaterID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HMaterID"].ToString());
                    oItemSub.HUnitID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HUnitID"].ToString());
                    oItemSub.HQty = DBUtility.ClsPub.isDoule(ds0.Tables[0].Rows[0]["HQty"].ToString());
                    oItemSub.HSourceID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HSourceID"].ToString());
                    oItemSub.HEquipID = 0;
                    oItemSub.HGroupID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HGroupID"].ToString());
                    oItemSub.HWorkerID = 0;
                    oItemSub.HBarCode = list.barcodes[i].barcode;
                    oItemSub.HBarCode_Pack = list.packagebarcode;
                    oItemSub.HCloseMan = "";
                    oItemSub.HCloseType = false;
                    oItemSub.HRemark = "";
                    oItemSub.HSourceInterID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HSourceInterID"].ToString());
                    oItemSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HSourceEntryID"].ToString());
                    oItemSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds0.Tables[0].Rows[0]["HSourceBillNo"].ToString());
                    oItemSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds0.Tables[0].Rows[0]["HSourceBillType"].ToString());
                    oItemSub.HRelationQty = 0;
                    oItemSub.HRelationMoney = 0;
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.status = 0;
                    objJsonResult.msg = "success";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.status = -1;
                    objJsonResult.msg = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.status =-1;
                objJsonResult.msg = e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç®±æ¡ç å–消绑定关系
        [Route("packagebarcode/cancel")]
        [HttpPost]
        public object cancel(string packagebarcode)
        {
            try
            {
                //
                oCN.BeginTran();
                //删除子表
                oCN.RunProc("Delete From Sc_PackUnionBillSub  where HBarCode_Pack=" + packagebarcode.ToString());
                //删除主表
                oCN.RunProc("Delete From Sc_PackUnionBillMain  where HBarCode_Pack=" + packagebarcode.ToString());
                //删除条码档案表
                oCN.RunProc("Delete From Gy_BarCodeBill  where HBarCode=" + packagebarcode.ToString());
                oCN.Commit();
                objJsonResult.status = 0;
                objJsonResult.msg = "success";
@@ -89,8 +237,8 @@
            }
            catch (Exception e)
            {
                objJsonResult.status =-1;
                objJsonResult.msg = "success";
                objJsonResult.status = -1;
                objJsonResult.msg = e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
WebAPI/DLL/ClsSc_PackUnionBill.cs
New file
@@ -0,0 +1,383 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace WebAPI.DLL
{
    public class ClsSc_PackUnionBill : DBUtility.ClsXt_BaseBill
    {
        public Models.ClsSc_PackUnionBillMain omodel = new Models.ClsSc_PackUnionBillMain();
        public List<Models.ClsSc_PackUnionBillSub> DetailColl = new List<Models.ClsSc_PackUnionBillSub>();
        public ClsSc_PackUnionBill()
        {
            base.MvarItemKeySub = "Sc_PackUnionBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "Sc_PackUnionBillMain";
            base.MvarReportTitle = "生产包装单";
            base.BillType = "3783";
        }
        #region å›ºå®šä»£ç 
        ~ClsSc_PackUnionBill()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sc_PackUnionBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +
                ",HDate='" + omodel.HDate + "'" +
                ",HICMOInterID=" + omodel.HICMOInterID + "" +
                ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
                ",HBarCode_Pack='" + omodel.HBarCode_Pack + "'" +
                ",HMaterID=" + omodel.HMaterID + "" +
                ",HUnitID=" + omodel.HUnitID + "" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpdater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpdateDate='" + DBUtility.ClsPub.GetServerDate(-1) + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                //DeleteRelation(ref sReturn, lngBillKey);
                ////删除子表
                DeleteBillSub(lngBillKey);
                ////插入子表
                omodel.HInterID = lngBillKey;
                foreach (Models.ClsSc_PackUnionBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_PackUnionBillSub " +
                      " (HInterID,HEntryID,HMaterID,HUnitID,HQty,HSourceID" +
                      ",HEquipID,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_Pack" +
                      ",HCloseMan,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)" +
                      " values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSourceID.ToString() + "" +
                      "," + oSub.HEquipID.ToString() + "," + oSub.HGroupID.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HScanDate.ToShortDateString() + "','" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "'" +
                      ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      ") ");
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Sc_PackUnionBillMain   " +
                "(HYear,HPeriod,HBillType,HInterID" +
                ",HDate,HBillNo,HBillStatus,HRemark,HICMOInterID" +
                ",HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID" +
                ",HMaker,HMakeDate" +
                ") " +
                " values(" + omodel.HYear + "," + omodel.HPeriod + ",'" + this.BillType + "'," + omodel.HInterID + "" +
                ",'" + omodel.HDate + "','" + omodel.HBillNo.ToString() + "'," + omodel.HBillStatus + ",'" + omodel.HRemark + "'," + omodel.HICMOInterID + "" +
                ",'" + omodel.HICMOBillNo.ToString() + "','" + omodel.HBarCode_Pack.ToString() + "'," + omodel.HMaterID + "," + omodel.HUnitID + "" +
                ",'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.GetServerDate(-1) + "'" +
                ") ");
                ////插入子表
                string HSourceInterID = "0";
                string HSourceEntryID = "0";
                string HSourceBillNo = "0";
                string HSourceBillType = "0";
                string HMaterID = "0";
                string HUnitID = "0";
                double HQty = 0;
                foreach (Models.ClsSc_PackUnionBillSub oSub in DetailColl)
                {
                    HSourceInterID = oSub.HSourceInterID.ToString();
                    HSourceEntryID = oSub.HSourceEntryID.ToString();
                    HSourceBillNo = oSub.HSourceBillNo.ToString();
                    HSourceBillType = oSub.HSourceBillType.ToString();
                    HMaterID = oSub.HMaterID.ToString();
                    HUnitID = oSub.HUnitID.ToString();
                    oCn.RunProc("Insert into Sc_PackUnionBillSub " +
                      " (HInterID,HEntryID,HMaterID,HUnitID,HQty,HSourceID" +
                      ",HEquipID,HGroupID,HWorkerID,HBarCode,HBarCode_Pack" +
                      ",HCloseMan,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)" +
                      " values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSourceID.ToString() + "" +
                      "," + oSub.HEquipID.ToString() + "," + oSub.HGroupID.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "'" +
                      ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      ") ");
                    HQty += oSub.HQty;
                }
                //箱码插入条码档案表
                oCn.RunProc("insert into Gy_BarCodeBill(HInterID,HEntryID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HMakeDate " +
                             ",HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HUseFlag, HStopflag, HSupID, HGroupID, HPrintQty)" +
                             "values('" + HSourceInterID + "', 1, '" + omodel.HBarCode_Pack + "', '箱号条码', '" + HMaterID + "', '" + HUnitID + "','" + HQty + "', '', getdate()" +
                             ", '" + HSourceInterID + "', '" + HSourceEntryID + "', '" + HSourceBillNo + "', '" + HSourceBillType + "', 1, 0, 0, 0, 0)");
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select * from Sc_PackUnionBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_PackUnionBillMain");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //赋值
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                //
                omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]);
                omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]);
                omodel.HBarCode_Pack = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode_Pack"]);
                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
                omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]);
                //
                omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]);
                omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]);
                omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]);
                omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]);
                omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]);
                omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]);
                omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]);
                omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]);
                omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]);
                omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]);
                omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]);
                omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]);
                //循环
                DataSet DsSub;
                DsSub = oCn.RunProcReturn("Select * from Sc_PackUnionBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_PackUnionBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Models.ClsSc_PackUnionBillSub oSub = new Models.ClsSc_PackUnionBillSub();
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
                    oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]);
                    oSub.HEquipID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEquipID"]);
                    oSub.HGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HGroupID"]);
                    oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]);
                    oSub.HScanDate = Convert.ToDateTime(DsSub.Tables[0].Rows[i]["HScanDate"]);
                    oSub.HBarCode = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBarCode"]);
                    oSub.HBarCode_Pack =DBUtility.ClsPub.isStrNull( DsSub.Tables[0].Rows[i]["HBarCode_Pack"]);
                    oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
                    //
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]);
                    oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]);
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        /// <summary>
        ///  æ¡ç æ‰«æè®°å½•,新增到包装单子表(状态为 0  ä¸´æ—¶è®°å½•)
        /// </summary>
        /// <param name="DetailColl"></param>
        /// <param name="sReturn"></param>
        /// <returns></returns>
        public bool AddBill_PDA(Model.ClsSc_PackUnionBillSub oSub, ref string sReturn)
        {
            try
            {
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                ////插入子表
                oCn.RunProc("Insert into Sc_PackUnionBillSub " +
                  " (HInterID,HEntryID,HMaterID,HUnitID,HQty,HSourceID" +
                  ",HEquipID,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_Pack" +
                  ",HCloseMan,HCloseType,HRemark,HStatus" +
                  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)" +
                  " values("
                  + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSourceID.ToString() + "" +
                  "," + oSub.HEquipID.ToString() + "," + oSub.HGroupID.ToString() + "," + oSub.HWorkerID.ToString() + ",getdate(),'" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "'" +
                  ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "',0" +
                  "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                  ") ");
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //条码扫描记录,新增到包装单
        public bool AddBill_PDA(Model.ClsSc_PackUnionBillMain omodel, ref string sReturn)
        {
            try
            {
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //修改子表状态为 1  , æœ‰æ•ˆæ•°æ®
                oCn.RunProc("update Sc_PackUnionBillSub set HStatus=1 where HInterID=" + omodel.HInterID.ToString());
                //主表
                oCn.RunProc("Insert Into Sc_PackUnionBillMain   " +
                "(HYear,HPeriod,HBillType,HInterID" +
                ",HDate,HBillNo,HBillStatus,HRemark,HICMOInterID" +
                ",HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID" +
                ",HMaker,HMakeDate" +
                ") " +
                " values(" + omodel.HYear + "," + omodel.HPeriod + ",'" + this.BillType + "'," + omodel.HInterID + "" +
                ",getdate(),'" + omodel.HBillNo.ToString() + "'," + omodel.HBillStatus + ",'" + omodel.HRemark + "'," + omodel.HICMOInterID + "" +
                ",'" + omodel.HICMOBillNo.ToString() + "','" + omodel.HBarCode_Pack.ToString() + "'," + omodel.HMaterID + "," + omodel.HUnitID + "" +
                ",'" + omodel.HMaker + "',getdate()" +
                ") ");
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码返回项目信息
        public DataSet GetInfoByID_View(long HInterID, string sWhere)
        {
            DataSet DS;
            try
            {
                DS = oCn.RunProcReturn("Select * from h_v_Sc_PackUnionBillSub Where HInterID=" + HInterID.ToString() + " " + sWhere, "h_v_Sc_PackUnionBillSub", ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                    return null;
                else
                {
                    return DS;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //判断条码临时表中是否存在
        public bool IsBarCodePack(string HBarCode_Pack)
        {
            DataSet DS;
            try
            {
                DS = oCn.RunProcReturn("Select * from Sc_PackUnionBillMain Where  HBarCode_Pack='" + HBarCode_Pack + "'", "Sc_PackUnionBillMain", ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                    return true;       //不存在相同条码
                else
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //判断条码临时表中是否存在
        public bool IsBarCode(string sBarCode)
        {
            DataSet DS;
            try
            {
                DS = oCn.RunProcReturn("Select * from Sc_PackUnionBillSub Where  HBarCode='" + sBarCode + "'", "Sc_PackUnionBillSub", ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                    return true;       //不存在相同条码
                else
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //审核包装单(如果子表中的条码不在条码档案中 åˆ™ï¼Œåœ¨æ¡£æ¡ˆä¸­è‡ªåŠ¨ç”Ÿæˆï¼‰
        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                string HChecker =DBUtility.ClsPub.CurUserName;
                //string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
                oCn.RunProc("Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate=getdate() Where HInterID=" + lngBillKey.ToString());
                oCn.RunProc("exec h_p_WMS_PackUnionToBarCode   " + lngBillKey.ToString() ); //更新条码档案
                sReturn = "";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
    }
}
WebAPI/Models/ClsSc_PackUnionBillMain.cs
New file
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WebAPI.Models
{
    public class ClsSc_PackUnionBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HICMOInterID;
        public string HICMOBillNo;
        public string HBarCode_Pack;
        public Int64 HMaterID;
        public Int64 HUnitID;
    }
}
WebAPI/Models/ClsSc_PackUnionBillSub.cs
New file
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WebAPI.Models
{
    public class ClsSc_PackUnionBillSub : DBUtility.ClsXt_BaseBillSub
    {
        //============
        public Int64 HMaterID;
        public Int64 HUnitID;
        public double HQty;
        public Int64 HErpClsID;
        public Int64 HSourceID;
        public Int64 HEquipID;
        public Int64 HGroupID;
        public Int64 HWorkerID;
        public DateTime HScanDate;
        public string HBatchNo;
        public string HBarCode;
        public string HBarCode_Pack;
    }
}
WebAPI/WebAPI.csproj
@@ -349,7 +349,6 @@
    <Compile Include="Controllers\Open_PrintTemController.cs" />
    <Compile Include="Controllers\ReportStepPlatFormController.cs" />
    <Compile Include="Controllers\博日自动扫码线\ScanlineAPIController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_StockCheckItemBillController.cs" />
    <Compile Include="Controllers\工资管理\Pay_OtherBalBillController.cs" />
    <Compile Include="Controllers\工资管理\Pay_GroupBalBillController.cs" />
    <Compile Include="Controllers\PurchaseOrderController.cs" />
@@ -450,9 +449,11 @@
    <Compile Include="DLL\ClsSc_MouldOtherOutBill.cs" />
    <Compile Include="DLL\ClsSc_MouldOtherInBill.cs" />
    <Compile Include="DLL\ClsSc_MouldMoveStockStepOutBill.cs" />
    <Compile Include="DLL\ClsSc_PackUnionBill.cs" />
    <Compile Include="DLL\工资管理\ClsPay_GroupBalBill.cs" />
    <Compile Include="DLL\工资管理\ClsPay_WorkTimesBill.cs" />
    <Compile Include="Models\ClsGy_StockCheckItemBill.cs" />
    <Compile Include="Models\ClsSc_PackUnionBillMain.cs" />
    <Compile Include="Models\ClsSc_PackUnionBillSub.cs" />
    <Compile Include="Models\jsonScanline.cs" />
    <Compile Include="Models\ScanLineCode.cs" />
    <Compile Include="Models\工资管理\ClsPay_GroupBalBillEmp.cs" />