Ejemplo n.º 1
0
    public static string insertDemandApplyReport(string hospitalName, string netSales, string stock,
                                                 string productName, string agentName, string spec, string unit, string applyNumber, string remark, UserInfo userInfo, List <string> approverList, List <string> informerList)
    {
        // 通过产品名 规格 单位来确定产品代码
        DataSet productDs = DemandApplyReportSrv.findProductCode(productName, spec, unit);

        string productCode = "";

        if (productDs != null && productDs.Tables[0].Rows.Count > 0)
        {
            productCode = productDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过医院名来确定医院代码
        DataSet hospitalDs = DemandApplyReportSrv.findHospitalCode(hospitalName);

        string hospitalCode = "";

        if (hospitalDs != null && hospitalDs.Tables[0].Rows.Count > 0)
        {
            hospitalCode = hospitalDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过代理商名称来确定代理商编码
        DataSet agentDs = DeliverApplyReportSrv.findAgentCode(agentName);

        string agentCode = "";

        if (agentDs != null && agentDs.Tables[0].Rows.Count > 0)
        {
            agentCode = agentDs.Tables[0].Rows[0][0].ToString();
        }

        string data = DemandApplyReportSrv.insertDemandApplyReport(hospitalCode, productCode, agentCode, applyNumber, remark, userInfo, netSales, stock);
        string id   = JsonHelper.DeserializeJsonToObject <JObject>(data)["Id"].ToString();

        // 新增审批人到审批流程表中
        List <JObject> list = new List <JObject>();

        for (int i = 0; i < approverList.Count; i++)
        {
            JObject jO = new JObject();
            jO.Add("index", i);
            jO.Add("userId", approverList[i]);

            list.Add(jO);
        }

        MobileReimburseSrv.insertApprovalProcess(id, list, "demand_apply_report");

        DataSet maxIdDt = DemandApplyReportSrv.findMaxId();
        string  docCode = maxIdDt.Tables[0].Rows[0][0].ToString();

        // 审批单提交
        ApprovalFlowManage.SubmitDocument("demand_apply_report", docCode, userInfo,
                                          "http://yelioa.top//mDemandApplyReportAppRoval.aspx?type=0&docCode=" + docCode, "http://yelioa.top//mDemandApplyReportAppRoval.aspx?type=1&docCode=" + docCode,
                                          "AirlZ8lfY50d1KGDklHPQcLV2RUFAdrhD-WXU23cA-w", "DemandApplyReport", "1000013");

        // 新增知悉人到表
        DemandApplyReportSrv.insertInformer(docCode, informerList);

        return("提交成功");
    }
Ejemplo n.º 2
0
    //public static string findSpecAndUnit(string name)
    //{
    //    DataSet ds = DeliverApplyReportSrv.findSpecAndUnit(name);

    //    if (ds == null || ds.Tables[0].Rows.Count == 0)
    //        return null;

    //    DataTable specDt = new DataTable();
    //    specDt.Columns.Add("value", Type.GetType("System.String"));
    //    specDt.Columns.Add("target", Type.GetType("System.String"));

    //    DataTable unitDt = new DataTable();
    //    unitDt.Columns.Add("value", Type.GetType("System.String"));
    //    unitDt.Columns.Add("target", Type.GetType("System.String"));

    //    List<string> specList = new List<string>();
    //    List<string> unitList = new List<string>();

    //    foreach (DataRow row in ds.Tables[0].Rows)
    //    {
    //        if (row["specification"] != null && !specList.Contains(row["specification"].ToString()))
    //        {
    //            DataRow specDr = specDt.NewRow();
    //            specDr["value"] = row["specification"];
    //            specDr["target"] = row["specification"];

    //            specDt.Rows.Add(specDr);

    //            specList.Add(row["specification"].ToString());
    //        }

    //        if (row["unit"] != null && !unitList.Contains(row["unit"].ToString()))
    //        {
    //            DataRow unitDr = unitDt.NewRow();
    //            unitDr["value"] = row["unit"];
    //            unitDr["target"] = row["unit"];

    //            unitDt.Rows.Add(unitDr);

    //            unitList.Add(row["unit"].ToString());
    //        }
    //    }

    //    JObject jObject = new JObject();

    //    jObject.Add("specJson", JsonHelper.DataTable2Json(specDt));
    //    jObject.Add("unitJson", JsonHelper.DataTable2Json(unitDt));

    //    return jObject.ToString();
    //}

    public static string insertDeliverApplyReport(string deliverType, string hospitalName,
                                                  string productName, string agentName, string spec, string unit, string applyNumber, string remark, UserInfo userInfo,
                                                  List <string> approverList, List <string> informerList, List <string> uploadFileUrlsList,
                                                  string stock, string netSales, string period, string isStockReceiptTogether, string deliverAddress, string deliverName, string deliverPhone)
    {
        // 通过产品名 规格 单位来确定产品代码
        DataSet productDs = DeliverApplyReportSrv.findProductCode(productName, spec, unit);

        string productCode = "";

        if (productDs != null && productDs.Tables[0].Rows.Count > 0)
        {
            productCode = productDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过医院名来确定医院代码
        DataSet hospitalDs = DeliverApplyReportSrv.findHospitalCode(hospitalName);

        string hospitalCode = "";

        if (hospitalDs != null && hospitalDs.Tables[0].Rows.Count > 0)
        {
            hospitalCode = hospitalDs.Tables[0].Rows[0][0].ToString();
        }

        // 通过代理商名称来确定代理商编码
        DataSet agentDs = DeliverApplyReportSrv.findAgentCode(agentName);

        string agentCode = "";

        if (agentDs != null && agentDs.Tables[0].Rows.Count > 0)
        {
            agentCode = agentDs.Tables[0].Rows[0][0].ToString();
        }

        string data = DeliverApplyReportSrv.insertDeliverApplyReport(deliverType, hospitalCode, productCode, agentCode, applyNumber,
                                                                     remark, userInfo, stock, netSales, period, isStockReceiptTogether, deliverAddress, deliverName, deliverPhone);

        string id = JsonHelper.DeserializeJsonToObject <JObject>(data)["Id"].ToString();

        // 新增审批人到审批流程表中
        List <JObject> list = new List <JObject>();

        if (Double.Parse(applyNumber) > ((Double.Parse(netSales) / 30 * Double.Parse(period)) - Double.Parse(stock)))
        {
            approverList.Insert(1, "100000645");
        }

        for (int i = 0; i < approverList.Count; i++)
        {
            JObject jO = new JObject();

            jO.Add("index", i);
            jO.Add("userId", approverList[i]);

            list.Add(jO);
        }

        MobileReimburseSrv.insertApprovalProcess(id, list, "deliver_apply_report");

        // 审批单提交
        ApprovalFlowManage.SubmitDocument("deliver_apply_report", id, userInfo,
                                          "http://yelioa.top//mDeliverApplyReportAppRoval.aspx?type=0&docCode=" + id, "http://yelioa.top//mDeliverApplyReportAppRoval.aspx?type=1&docCode=" + id,
                                          "vvsnJs9JYf8AisLWOE4idJbdR1QGc7roIcUtN6P2Lhc", "DeliverApplyReport", "1000009");

        // 新增知悉人到表
        DeliverApplyReportSrv.insertInformer(id, informerList);

        if (uploadFileUrlsList != null && uploadFileUrlsList.Count > 0)
        {
            DeliverApplyReportSrv.insertAttachement(id, uploadFileUrlsList);
        }

        //// 新增一条记录到审批记录表中
        //DeliverApplyReportSrv.insertDeliverAppyReportRecord("0", userInfo.wechatUserId, userInfo.wechatUserId, "发货申请单提交", "");

        //// 给待审批人发送消息
        //WxNetSalesHelper wxNetSalesHelper = new WxNetSalesHelper();

        //wxNetSalesHelper.GetJsonAndSendWxMsg(approverIds, "请及时审批 提交人为:" + userInfo.userName
        //    + "的发货申请单,谢谢!", "http://yelioa.top/mNetSalesApproval.aspx?type=others");
        //// 给提交人发送消息
        //wxNetSalesHelper.GetJsonAndSendWxMsg(userInfo.wechatUserId, "您的发货申请单已提交,请点击查看", "http://yelioa.top/mNetSalesApproval.aspx?type=mine");

        return("提交人");
    }