|
@@ -0,0 +1,2377 @@
|
|
|
+package controllers
|
|
|
+
|
|
|
+import (
|
|
|
+ "Medical_ERP/common/global"
|
|
|
+ _ "Medical_ERP/common/response"
|
|
|
+ "Medical_ERP/dto"
|
|
|
+ "Medical_ERP/models"
|
|
|
+ "Medical_ERP/services"
|
|
|
+ "Medical_ERP/utils"
|
|
|
+ "baliance.com/gooxml/color"
|
|
|
+ "baliance.com/gooxml/document"
|
|
|
+ "baliance.com/gooxml/measurement"
|
|
|
+ "baliance.com/gooxml/schema/soo/wml"
|
|
|
+ "fmt"
|
|
|
+ "github.com/jung-kurt/gofpdf"
|
|
|
+ "github.com/signintech/gopdf"
|
|
|
+ "github.com/xuri/excelize/v2"
|
|
|
+ "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth/beegouser"
|
|
|
+ "os"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type StockTemplateController struct {
|
|
|
+ BaseController
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateIn 入库
|
|
|
+// @Summary 入库
|
|
|
+// @Description 入库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateInInsertReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/in [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateIn() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateInInsertReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetCreateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.StockTemplateIn(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(reqData.GetId(), "入库成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateInEdit 修改入库
|
|
|
+// @Summary 修改入库
|
|
|
+// @Description 修改入库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateInEditReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/in [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateInEdit() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateInEditReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetUpdateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.StockTemplateInEdit(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(reqData.GetId(), "修改入库信息成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateInDelete 删除入库
|
|
|
+// @Summary 删除入库
|
|
|
+// @Description 删除入库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateInDeleteReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/in [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateInDelete() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateInDeleteReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetUpdateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.StockTemplateInDelete(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(reqData.GetId(), "删除入库信息成功")
|
|
|
+}
|
|
|
+
|
|
|
+// BatchStockTemplateIn 批量入库
|
|
|
+// @Summary 批量入库
|
|
|
+// @Description 批量入库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.BatchStockTemplateInInsertReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/in [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) BatchStockTemplateIn() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.BatchStockTemplateInInsertReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetCreateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.BatchStockTemplateIn(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(nil, "入库成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateOut 出库
|
|
|
+// @Summary 出库
|
|
|
+// @Description 出库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateOutInsertReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/out [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateOut() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateOutInsertReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetCreateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.StockTemplateOut(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(reqData.GetId(), "出库成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateOutEdit 修改入库
|
|
|
+// @Summary 修改入库
|
|
|
+// @Description 修改入库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateOutEditReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/in [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateOutEdit() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateOutEditReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetUpdateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.StockTemplateOutEdit(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(reqData.GetId(), "修改出库信息成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateOutDelete 删除入库
|
|
|
+// @Summary 删除入库
|
|
|
+// @Description 删除入库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateOutDeleteReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/in [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateOutDelete() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateOutDeleteReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetUpdateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.StockTemplateOutDelete(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(reqData.GetId(), "删除出库信息成功")
|
|
|
+}
|
|
|
+
|
|
|
+// BatchStockTemplateOut 批量出库
|
|
|
+// @Summary 批量出库
|
|
|
+// @Description 批量出库
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateOutInsertReq true "body"
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/out [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) BatchStockTemplateOut() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.BatchStockTemplateOutInsertReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reqData.SetCreateBy(beegouser.GetUserId(c.Ctx))
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
+ err := s.BatchStockTemplateOut(&reqData)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OK(nil, "出库成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateInList 入库列表
|
|
|
+// @Summary 入库列表
|
|
|
+// @Description 入库列表
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateInPageReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/in/list [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateInList() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateInPageReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, count, err := s.StockTemplateInList(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, int(count), reqData.GetPageIndex(), reqData.GetPageSize(), "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateOutList 出库列表
|
|
|
+// @Summary 出库列表
|
|
|
+// @Description 出库列表
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateOutPageReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/out/list [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateOutList() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateOutPageReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, count, err := s.StockTemplateOutList(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, int(count), reqData.GetPageIndex(), reqData.GetPageSize(), "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateInventoryList 收发记录
|
|
|
+// @Summary 收发记录
|
|
|
+// @Description 收发记录
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateInventoryPageReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/inventory/list [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateInventoryList() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockTemplateInventoryPageReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, count, err := s.StockTemplateInventoryList(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, int(count), reqData.GetPageIndex(), reqData.GetPageSize(), "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockTemplateInventoryExcel 收发登记表
|
|
|
+// @Summary 收发登记表
|
|
|
+// @Description 收发登记表
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockTemplateInventoryExcelReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/inventory/list [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockTemplateInventoryExcel(reqData dto.StockTemplateInventoryExcelReq) {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ //reqData := dto.StockTemplateInventoryExcelReq{}
|
|
|
+ //if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ // c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ models.InitBasicData(deptId)
|
|
|
+ medicineInfo, err := s.GetMedicineInfo(deptId, map[string]interface{}{
|
|
|
+ "product_id": reqData.ProductID,
|
|
|
+ "enterprise_id": reqData.EnterpriseID,
|
|
|
+ "spec_id": reqData.SpecId,
|
|
|
+ "batch_number": reqData.BatchNumber,
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ c.Error(global.BadRequest, err, "药品信息不存在")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var productName, specName, unitName, dosageFormName string
|
|
|
+
|
|
|
+ if id, ok := medicineInfo[models.FieldProductID]; ok {
|
|
|
+ productName = models.Read_Product_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+ if id, ok := medicineInfo[models.FieldSpecID]; ok {
|
|
|
+ specName = models.Read_Spec_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+ if id, ok := medicineInfo[models.FieldUnitID]; ok {
|
|
|
+ unitName = models.Read_Unit_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+ if id, ok := medicineInfo[models.FieldDosageFormID]; ok {
|
|
|
+ dosageFormName = models.Read_DosageForm_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+
|
|
|
+ list, err := s.StockTemplateInventoryExcel(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ f := excelize.NewFile() // 设置单元格的值
|
|
|
+ StyleTitle, _ := f.NewStyle(
|
|
|
+ &excelize.Style{
|
|
|
+ Font: &excelize.Font{Bold: true, Size: 20, Family: "宋体"},
|
|
|
+ Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
|
|
|
+ })
|
|
|
+ f.MergeCell("Sheet1", "A1", "O1")
|
|
|
+ f.SetRowStyle("Sheet1", 1, 1, StyleTitle)
|
|
|
+ f.SetRowHeight("Sheet1", 1, 50)
|
|
|
+ var interval string
|
|
|
+ if len(reqData.StartDate) > 0 && len(reqData.EndDate) > 0 {
|
|
|
+ interval = fmt.Sprintf("%s至%s", reqData.StartDate, reqData.EndDate)
|
|
|
+ }
|
|
|
+ f.SetCellValue("Sheet1", "A1", fmt.Sprintf("%s收发登记表", interval))
|
|
|
+
|
|
|
+ StyleLittleTitle, _ := f.NewStyle(
|
|
|
+ &excelize.Style{
|
|
|
+ Font: &excelize.Font{Size: 12, Family: "宋体"},
|
|
|
+ })
|
|
|
+
|
|
|
+ f.SetCellValue("Sheet1", "K2", fmt.Sprintf("制品名称:%s", productName))
|
|
|
+ f.SetCellValue("Sheet1", "K3", fmt.Sprintf("剂型:%s 规格:%s 单位:%s", dosageFormName, specName, unitName))
|
|
|
+ f.SetRowStyle("Sheet1", 2, 3, StyleLittleTitle)
|
|
|
+
|
|
|
+ // 这里设置表头
|
|
|
+ f.MergeCell("Sheet1", "A4", "A5")
|
|
|
+ f.SetCellValue("Sheet1", "A4", "日期")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "B4", "B5")
|
|
|
+ f.SetCellValue("Sheet1", "B4", "购货/发货单位")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "C4", "C5")
|
|
|
+ f.SetCellValue("Sheet1", "C4", "生产企业")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "D4", "D5")
|
|
|
+ f.SetCellValue("Sheet1", "D4", "批准文号")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "E4", "E5")
|
|
|
+ f.SetCellValue("Sheet1", "E4", "批签发合格证编号")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "F4", "H4")
|
|
|
+ f.SetCellValue("Sheet1", "F4", "收入")
|
|
|
+ f.SetCellValue("Sheet1", "F5", "数量")
|
|
|
+ f.SetCellValue("Sheet1", "G5", "批号")
|
|
|
+ f.SetCellValue("Sheet1", "H5", "效期")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "I4", "K4")
|
|
|
+ f.SetCellValue("Sheet1", "I4", "支出")
|
|
|
+ f.SetCellValue("Sheet1", "I5", "数量")
|
|
|
+ f.SetCellValue("Sheet1", "J5", "批号")
|
|
|
+ f.SetCellValue("Sheet1", "K5", "效期")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "L4", "N4")
|
|
|
+ f.SetCellValue("Sheet1", "L4", "结余")
|
|
|
+ f.SetCellValue("Sheet1", "L5", "数量")
|
|
|
+ f.SetCellValue("Sheet1", "M5", "批号")
|
|
|
+ f.SetCellValue("Sheet1", "N5", "效期")
|
|
|
+
|
|
|
+ f.MergeCell("Sheet1", "O4", "O5")
|
|
|
+ f.SetCellValue("Sheet1", "O4", "经办人签字")
|
|
|
+
|
|
|
+ // 设置列宽
|
|
|
+ f.SetColWidth("Sheet1", "A", "B", 10)
|
|
|
+ f.SetColWidth("Sheet1", "B", "F", 12)
|
|
|
+ f.SetColWidth("Sheet1", "F", "G", 8)
|
|
|
+ f.SetColWidth("Sheet1", "G", "I", 12)
|
|
|
+ f.SetColWidth("Sheet1", "I", "J", 8)
|
|
|
+ f.SetColWidth("Sheet1", "J", "L", 12)
|
|
|
+ f.SetColWidth("Sheet1", "L", "M", 8)
|
|
|
+ f.SetColWidth("Sheet1", "M", "O", 12)
|
|
|
+ f.SetColWidth("Sheet1", "O", "P", 12)
|
|
|
+
|
|
|
+ line := 5
|
|
|
+
|
|
|
+ // 循环写入数据
|
|
|
+ for _, v := range list {
|
|
|
+ line++
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("A%d", line), v["date"])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("C%d", line), v[models.FieldEnterpriseName])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("D%d", line), v[models.FieldApprovalNumber])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("E%d", line), v[models.FieldQualificationNumber])
|
|
|
+ if utils.ToInt(v["stock_in_id"]) > 0 {
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), v["forwarding_unit"])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), utils.ToInt(v["total_in"]))
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), v[models.FieldApprovalNumber])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("H%d", line), v[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
+ }
|
|
|
+ if utils.ToInt(v["stock_out_id"]) > 0 {
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), v["receiving_unit"])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), utils.ToInt(v["total_out"]))
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("J%d", line), v[models.FieldApprovalNumber])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("K%d", line), v[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
+ }
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("L%d", line), utils.ToInt(v["balance"]))
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("M%d", line), v[models.FieldApprovalNumber])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("N%d", line), v[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
+
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("O%d", line), v["operator"])
|
|
|
+
|
|
|
+ }
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("A%d", line+1), "保管单位:"+beegouser.GetDeptName(c.Ctx))
|
|
|
+ f.SetRowStyle("Sheet1", line+1, line+1, StyleLittleTitle)
|
|
|
+
|
|
|
+ Style1, _ := f.NewStyle(
|
|
|
+ &excelize.Style{
|
|
|
+ Font: &excelize.Font{Size: 13, Family: "宋体", Bold: true},
|
|
|
+ Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center", WrapText: true},
|
|
|
+ Border: []excelize.Border{
|
|
|
+ {Type: "left", Color: "000000", Style: 1},
|
|
|
+ {Type: "top", Color: "000000", Style: 1},
|
|
|
+ {Type: "bottom", Color: "000000", Style: 1},
|
|
|
+ {Type: "right", Color: "000000", Style: 1},
|
|
|
+ },
|
|
|
+ })
|
|
|
+ f.SetCellStyle("Sheet1", "A4", "O5", Style1)
|
|
|
+ Style2, _ := f.NewStyle(
|
|
|
+ &excelize.Style{
|
|
|
+ Font: &excelize.Font{Size: 12, Family: "宋体"},
|
|
|
+ Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center", WrapText: true},
|
|
|
+ Border: []excelize.Border{
|
|
|
+ {Type: "left", Color: "000000", Style: 1},
|
|
|
+ {Type: "top", Color: "000000", Style: 1},
|
|
|
+ {Type: "bottom", Color: "000000", Style: 1},
|
|
|
+ {Type: "right", Color: "000000", Style: 1},
|
|
|
+ },
|
|
|
+ })
|
|
|
+ f.SetCellStyle("Sheet1", "A6", fmt.Sprintf("O%d", line), Style2)
|
|
|
+
|
|
|
+ filename := "收发登记表" + time.Now().Format("20060102150405") + ".xlsx"
|
|
|
+ // 保存文件
|
|
|
+ if err := f.SaveAs("ofile/" + filename); err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ os.Remove("ofile/" + filename)
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 返回生成的 Excel 文件
|
|
|
+ c.Ctx.Output.Download("ofile/" + filename)
|
|
|
+}
|
|
|
+func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemplateInventoryExcelReq) {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ models.InitBasicData(deptId)
|
|
|
+ medicineInfo, err := s.GetMedicineInfo(deptId, map[string]interface{}{
|
|
|
+ "product_id": reqData.ProductID,
|
|
|
+ "enterprise_id": reqData.EnterpriseID,
|
|
|
+ "spec_id": reqData.SpecId,
|
|
|
+ "batch_number": reqData.BatchNumber,
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ c.Error(global.BadRequest, err, "药品信息不存在")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var productName, specName, unitName, dosageFormName string
|
|
|
+
|
|
|
+ if id, ok := medicineInfo[models.FieldProductID]; ok {
|
|
|
+ productName = models.Read_Product_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+ if id, ok := medicineInfo[models.FieldSpecID]; ok {
|
|
|
+ specName = models.Read_Spec_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+ if id, ok := medicineInfo[models.FieldUnitID]; ok {
|
|
|
+ unitName = models.Read_Unit_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+ if id, ok := medicineInfo[models.FieldDosageFormID]; ok {
|
|
|
+ dosageFormName = models.Read_DosageForm_Get(utils.ToInt(id))
|
|
|
+ }
|
|
|
+
|
|
|
+ list, err := s.StockTemplateInventoryExcel(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ cols := []float64{20, 24, 20, 18, 20, 12, 22, 20, 12, 22, 20, 12, 22, 20, 15}
|
|
|
+
|
|
|
+ rows := [][]string{}
|
|
|
+ for _, row := range list {
|
|
|
+ temp := []string{}
|
|
|
+ temp = append(temp, fmt.Sprintf("%v", row["date"]))
|
|
|
+
|
|
|
+ if utils.ToInt(row["stock_in_id"]) > 0 {
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row["forwarding_unit"]))
|
|
|
+ } else if utils.ToInt(row["stock_out_id"]) > 0 {
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row["receiving_unit"]))
|
|
|
+ }
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldEnterpriseName]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldApprovalNumber]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldQualificationNumber]))
|
|
|
+
|
|
|
+ if utils.ToInt(row["stock_in_id"]) > 0 {
|
|
|
+ temp = append(temp, fmt.Sprintf("%d", row["total_in"]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
+ } else {
|
|
|
+ temp = append(temp, "")
|
|
|
+ temp = append(temp, "")
|
|
|
+ temp = append(temp, "")
|
|
|
+ }
|
|
|
+
|
|
|
+ if utils.ToInt(row["stock_out_id"]) > 0 {
|
|
|
+ temp = append(temp, fmt.Sprintf("%d", row["total_out"]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
+ } else {
|
|
|
+ temp = append(temp, "")
|
|
|
+ temp = append(temp, "")
|
|
|
+ temp = append(temp, "")
|
|
|
+ }
|
|
|
+
|
|
|
+ temp = append(temp, fmt.Sprintf("%d", row["balance"]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row["operator"]))
|
|
|
+ rows = append(rows, temp)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ pdf := gofpdf.New("L", "mm", "A4", "")
|
|
|
+
|
|
|
+ pdf.AddPage()
|
|
|
+ pdf.AddUTF8Font("simsun", "", "static/fonts/MiSans-Medium.ttf")
|
|
|
+ pdf.SetFont("simsun", "", 20)
|
|
|
+ pdf.SetMargins(10, 10, 10)
|
|
|
+ pdf.SetAutoPageBreak(false, 0)
|
|
|
+ pagew, pageh := pdf.GetPageSize()
|
|
|
+ _, _, _, mbottom := pdf.GetMargins()
|
|
|
+ titleStr := "收发登记表"
|
|
|
+
|
|
|
+ titleWd := pdf.GetStringWidth(titleStr)
|
|
|
+ titleX := (pagew - titleWd) / 2
|
|
|
+ pdf.Text(titleX, 20, titleStr)
|
|
|
+
|
|
|
+ titleX = pagew / 3 * 2
|
|
|
+ pdf.SetFont("simsun", "", 10)
|
|
|
+ pdf.Text(titleX, 25, fmt.Sprintf("制品名称:%s 编号", productName))
|
|
|
+ pdf.Text(titleX, 30, fmt.Sprintf("剂型:%s 规格:%s 单位:%s", dosageFormName, specName, unitName))
|
|
|
+
|
|
|
+ h := 16.0
|
|
|
+ curx, y := pdf.GetXY()
|
|
|
+ pdf.SetXY(curx, 35)
|
|
|
+ pdf.CellFormat(cols[0], h, "日期", "1", 0, "CM", false, 0, "")
|
|
|
+ pdf.CellFormat(cols[1], h, "购货/发货单位", "1", 0, "CM", false, 0, "")
|
|
|
+ pdf.CellFormat(cols[2], h, "生产企业", "1", 0, "CM", false, 0, "")
|
|
|
+ pdf.CellFormat(cols[3], h, "批准文号", "1", 0, "CM", false, 0, "")
|
|
|
+ curx, y = pdf.GetXY()
|
|
|
+ width := cols[4]
|
|
|
+ pdf.MultiCell(width, h/2, "批签发合格\n证编号", "1", "CM", false)
|
|
|
+
|
|
|
+ // ------收入
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ width = cols[5] + cols[6] + cols[7]
|
|
|
+ pdf.CellFormat(width, h/2, "收入", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ width = cols[5]
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ pdf.CellFormat(width, h/2, "数量", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ width = cols[6]
|
|
|
+ pdf.CellFormat(width, h/2, "批号", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ width = cols[7]
|
|
|
+ pdf.CellFormat(width, h/2, "效期", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ // ------支出
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ width = cols[8] + cols[9] + cols[10]
|
|
|
+ pdf.CellFormat(width, h/2, "支出", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ width = cols[8]
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ pdf.CellFormat(width, h/2, "数量", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ width = cols[9]
|
|
|
+ pdf.CellFormat(width, h/2, "批号", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ width = cols[10]
|
|
|
+ pdf.CellFormat(width, h/2, "效期", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ // ------结余
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ width = cols[11] + cols[12] + cols[13]
|
|
|
+ pdf.CellFormat(width, h/2, "结余", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ width = cols[11]
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ pdf.CellFormat(width, h/2, "数量", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ width = cols[12]
|
|
|
+ pdf.CellFormat(width, h/2, "批号", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ curx += width
|
|
|
+ pdf.SetXY(curx, y+h/2)
|
|
|
+ width = cols[13]
|
|
|
+ pdf.CellFormat(width, h/2, "效期", "1", 0, "CM", false, 0, "")
|
|
|
+
|
|
|
+ curx += width
|
|
|
+ width = cols[14]
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ pdf.MultiCell(width, h/2, "经办人\n签字", "1", "CM", false)
|
|
|
+
|
|
|
+ pdf.SetFont("simsun", "", 9)
|
|
|
+ marginCell := 4. // margin of top/bottom of cell
|
|
|
+
|
|
|
+ for _, row := range rows {
|
|
|
+ curx, y = pdf.GetXY()
|
|
|
+ x := curx
|
|
|
+
|
|
|
+ height := 0.
|
|
|
+ _, lineHt := pdf.GetFontSize()
|
|
|
+
|
|
|
+ for i, txt := range row {
|
|
|
+ lines := pdf.SplitLines([]byte(txt), cols[i])
|
|
|
+ h := float64(len(lines))*lineHt + marginCell*float64(len(lines))
|
|
|
+ if h > height {
|
|
|
+ height = h
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // add a new page if the height of the row doesn't fit on the page
|
|
|
+ if pdf.GetY()+height > pageh-mbottom {
|
|
|
+ pdf.AddPage()
|
|
|
+ y = pdf.GetY()
|
|
|
+ }
|
|
|
+ for i, txt := range row {
|
|
|
+ width = cols[i]
|
|
|
+ pdf.Rect(x, y, width, height, "")
|
|
|
+ pdf.MultiCell(width, lineHt+marginCell, txt, "", "CM", false)
|
|
|
+ x += width
|
|
|
+ pdf.SetXY(x, y)
|
|
|
+ }
|
|
|
+ pdf.SetXY(curx, y+height)
|
|
|
+ }
|
|
|
+
|
|
|
+ filename := "收发登记表" + time.Now().Format("20060102150405") + ".pdf"
|
|
|
+ // 保存文件
|
|
|
+ if err := pdf.OutputFileAndClose("ofile/" + filename); err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ os.Remove("ofile/" + filename)
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 返回生成的 Excel 文件
|
|
|
+ c.Ctx.Output.Download("ofile/" + filename)
|
|
|
+}
|
|
|
+func (c StockTemplateController) StockTemplateInventoryExport() {
|
|
|
+ reqData := dto.StockTemplateInventoryExcelReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if reqData.Type == "excel" {
|
|
|
+ c.StockTemplateInventoryExcel(reqData)
|
|
|
+ }
|
|
|
+ if reqData.Type == "pdf" {
|
|
|
+ c.StockTemplateInventoryPdf(reqData)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// TransportRecordWord 运输记录表word
|
|
|
+// @Summary 收发登记表word
|
|
|
+// @Description 收发登记表word
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.TransportRecordWordReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock-template/inventory/list [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) TransportRecordWord(reqData dto.TransportRecordWordReq) {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+
|
|
|
+ list, err := s.StockTemplateTransportRecordWord(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ doc := document.New()
|
|
|
+ // 获取文档的默认页面设置
|
|
|
+ doc.BodySection().SetPageMargins(
|
|
|
+ 0.3*measurement.Inch,
|
|
|
+ 0.4*measurement.Inch,
|
|
|
+ 0.5*measurement.Inch,
|
|
|
+ 0.3*measurement.Inch,
|
|
|
+ 1*measurement.Inch,
|
|
|
+ 0.4*measurement.Inch,
|
|
|
+ 0.1*measurement.Inch)
|
|
|
+ ftr := doc.AddFooter()
|
|
|
+ para := ftr.AddParagraph()
|
|
|
+ //para.Properties().AddTabStop(0.1*measurement.Inch, wml.ST_TabJcCenter, wml.ST_TabTlcNone)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run := para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddTab()
|
|
|
+ run.AddText("第 ")
|
|
|
+ run.AddFieldWithFormatting(document.FieldCurrentPage, "", false)
|
|
|
+ run.AddText(" 页 / 共 ")
|
|
|
+ run.AddFieldWithFormatting(document.FieldNumberOfPages, "", false)
|
|
|
+ run.AddText(" 页")
|
|
|
+ //doc.BodySection().SetFooter(ftr, wml.ST_HdrFtrDefault)
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetBold(true)
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(14)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(18*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run.AddText("表3-4 运输记录表")
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(12)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(30*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+
|
|
|
+ run.AddText("(各级通用)")
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run.AddText("运输工具: □冷藏车 □运输车 □普通车辆 □无 □其他")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run.AddText("冷藏工具: □冷藏车 □车载冷藏箱 □冷藏箱或冷藏包 □其他")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run.AddText("配送方式: □本级配送(车牌号:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(") □下级自运(车牌号:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(")")
|
|
|
+
|
|
|
+ // --------------------运输情况
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetBold(true)
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("运输情况:")
|
|
|
+
|
|
|
+ table := doc.AddTable()
|
|
|
+ table.Properties().SetLayout(wml.ST_TblLayoutTypeFixed)
|
|
|
+ table.Properties().SetWidthPercent(100)
|
|
|
+ look := table.Properties().TableLook()
|
|
|
+ look.SetFirstColumn(true)
|
|
|
+ look.SetFirstRow(true)
|
|
|
+ look.SetHorizontalBanding(true)
|
|
|
+
|
|
|
+ // width of the page
|
|
|
+ // with thick borers
|
|
|
+ borders := table.Properties().Borders()
|
|
|
+ //borders.SetBottom(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ //borders.SetLeft(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ //borders.SetRight(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ //borders.SetTop(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ borders.SetAll(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+ //borders.SetInsideVertical(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+
|
|
|
+ row := table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.35*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell := row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("品名")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(12)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("生产企业")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("批准文号")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("批签发合格编号")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(13)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("规格(剂/支或粒)")
|
|
|
+
|
|
|
+ //cell = row.AddCell()
|
|
|
+ //cell.Properties().SetWidth(0.5 * measurement.Inch)
|
|
|
+ //para = cell.AddParagraph()
|
|
|
+ //cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ //para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ //run = para.AddRun()
|
|
|
+ //run.Properties().SetFontFamily("宋体")
|
|
|
+ //run.Properties().SetSize(8)
|
|
|
+ //run.AddText("生产日期")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(12)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("疫苗批号")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("疫苗效期")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(6)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("数量")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(6)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(9)
|
|
|
+ run.AddText("单位")
|
|
|
+
|
|
|
+ models.InitBasicData(deptId)
|
|
|
+ for _, medicineInfo := range list {
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.3*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ productName := models.Read_Product_Get(utils.ToInt(medicineInfo[models.FieldProductID]))
|
|
|
+ run.AddText(productName)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(12)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ enterpriseName := models.Read_Enterprise_Get(utils.ToInt(medicineInfo[models.FieldEnterpriseID]))
|
|
|
+ run.AddText(enterpriseName)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ run.AddText(medicineInfo[models.FieldApprovalNumber].(string))
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ run.AddText(medicineInfo[models.FieldQualificationNumber].(string))
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(13)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ specName := models.Read_Spec_Get(utils.ToInt(medicineInfo[models.FieldSpecID]))
|
|
|
+ run.AddText(specName)
|
|
|
+
|
|
|
+ //cell = row.AddCell()
|
|
|
+ //cell.Properties().SetWidth(0.5 * measurement.Inch)
|
|
|
+ //para = cell.AddParagraph()
|
|
|
+ //cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ //para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ //run = para.AddRun()
|
|
|
+ //run.Properties().SetFontFamily("宋体")
|
|
|
+ //run.Properties().SetSize(8)
|
|
|
+ //run.AddText("生产日期")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(12)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ run.AddText(medicineInfo[models.FieldBatchNumber].(string))
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ run.AddText(medicineInfo[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(6)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ run.AddText(fmt.Sprintf("%d", utils.ToInt(medicineInfo["quantity"])))
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(6)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ unitName := models.Read_Enterprise_Get(utils.ToInt(medicineInfo[models.FieldUnitID]))
|
|
|
+ run.AddText(unitName)
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(list) < 11 {
|
|
|
+ for i := 0; i < 11-len(list); i++ {
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.3*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(12)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(15)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(13)
|
|
|
+
|
|
|
+ //cell = row.AddCell()
|
|
|
+ //cell.Properties().SetWidth(0.5 * measurement.Inch)
|
|
|
+ //para = cell.AddParagraph()
|
|
|
+ //cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ //para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ //run = para.AddRun()
|
|
|
+ //run.Properties().SetFontFamily("宋体")
|
|
|
+ //run.Properties().SetSize(8)
|
|
|
+ //run.AddText("生产日期")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(12)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(6)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(6)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // --------------------运输温度记录
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(25*measurement.Point, wml.ST_LineSpacingRuleAtLeast)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetBold(true)
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("运输温度记录:")
|
|
|
+
|
|
|
+ table = doc.InsertTableAfter(para)
|
|
|
+ table.Properties().SetWidthPercent(100)
|
|
|
+ table.Properties().SetAlignment(wml.ST_JcTableCenter)
|
|
|
+ table.Properties().SetLayout(wml.ST_TblLayoutTypeAutofit)
|
|
|
+ look = table.Properties().TableLook()
|
|
|
+ look.SetFirstColumn(true)
|
|
|
+ look.SetFirstRow(true)
|
|
|
+ look.SetHorizontalBanding(true)
|
|
|
+
|
|
|
+ borders = table.Properties().Borders()
|
|
|
+ borders.SetBottom(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ borders.SetLeft(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ borders.SetRight(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ borders.SetTop(wml.ST_BorderSingle, color.Auto, 1*measurement.Point)
|
|
|
+ borders.SetInsideHorizontal(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+ borders.SetInsideVertical(wml.ST_BorderSingle, color.Auto, measurement.Zero)
|
|
|
+
|
|
|
+ //-----------------项目名称
|
|
|
+ row = table.AddRow()
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.AddText("")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(38)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("日期/时间")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(19)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(8)
|
|
|
+ run.AddText("疫苗储存温度")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(17)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("冰排状态")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(16)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("环境温度")
|
|
|
+
|
|
|
+ //------------------启运
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.4*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("启运")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(38)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("年")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("月")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("日")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("时")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("分")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(19)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(17)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run.AddText("")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(16)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+
|
|
|
+ //------------------途中
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.8*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("途中")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(38)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("年")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("月")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("日")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("时")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("分")
|
|
|
+
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("年")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("月")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("日")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("时")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("分")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(19)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(17)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetSize(5)
|
|
|
+ run.AddText("————————")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(16)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ para.Properties().Spacing().SetLineSpacing(20*measurement.Point, wml.ST_LineSpacingRuleAuto)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+
|
|
|
+ //------------------到达
|
|
|
+ row = table.AddRow()
|
|
|
+ row.Properties().SetHeight(0.4*measurement.Inch, wml.ST_HeightRuleAtLeast)
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(10)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("到达")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(38)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("年")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("月")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("日")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("时")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("分")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(19)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(17)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run.AddText("")
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(16)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcCenter)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("℃")
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().Spacing().SetLineSpacing(25*measurement.Point, wml.ST_LineSpacingRuleExact)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("启运至到达行驶里程数:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(" ")
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("千米。")
|
|
|
+
|
|
|
+ table3 := doc.AddTable()
|
|
|
+ table3.Properties().SetLayout(wml.ST_TblLayoutTypeFixed)
|
|
|
+ table3.Properties().SetWidthPercent(100)
|
|
|
+ look.SetFirstColumn(true)
|
|
|
+ look.SetFirstRow(true)
|
|
|
+ look.SetHorizontalBanding(true)
|
|
|
+ look = table3.Properties().TableLook()
|
|
|
+
|
|
|
+ borders3 := table3.Properties().Borders()
|
|
|
+ borders3.SetAll(wml.ST_BorderUnset, color.Auto, measurement.Zero)
|
|
|
+
|
|
|
+ row = table3.AddRow()
|
|
|
+ row.Properties().SetHeight(0.36*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(50)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("发货单位:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(beegouser.GetDeptName(c.Ctx))
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(50)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("发货人签名:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetSize(5)
|
|
|
+ run.AddText("________________________________________________________________")
|
|
|
+
|
|
|
+ row = table3.AddRow()
|
|
|
+ row.Properties().SetHeight(0.36*measurement.Inch, wml.ST_HeightRuleExact)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(50)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("收货单位:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText(reqData.ReceivingUnit)
|
|
|
+ run.Properties().SetUnderline(wml.ST_UnderlineSingle, color.Black)
|
|
|
+
|
|
|
+ cell = row.AddCell()
|
|
|
+ cell.Properties().SetWidthPercent(50)
|
|
|
+ para = cell.AddParagraph()
|
|
|
+ cell.Properties().SetVerticalAlignment(wml.ST_VerticalJcCenter)
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("收货人签名:")
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetSize(5)
|
|
|
+ run.AddText("________________________________________________________________")
|
|
|
+
|
|
|
+ para = doc.AddParagraph()
|
|
|
+ para.Properties().SetAlignment(wml.ST_JcLeft)
|
|
|
+ run = para.AddRun()
|
|
|
+ run.Properties().SetFontFamily("宋体")
|
|
|
+ run.Properties().SetSize(10)
|
|
|
+ run.AddText("填表说明:本表供疫苗配送企业、疾病预防控制机构、接种单位疫苗运输时填写;出入库单号为单位编码+年月日+2位流水号;运输超过6小时需记录途中温度,间隔不超过6小时;使用无自动温度显示的冰排保冷设备时,只在启运和达到时填写冰排状态(冻结、冰水混合物、完全融化)。")
|
|
|
+ doc.BodySection().SetFooter(ftr, wml.ST_HdrFtrDefault)
|
|
|
+
|
|
|
+ filename := "运输记录表" + time.Now().Format("20060102150405") + ".docx"
|
|
|
+ // 保存文件
|
|
|
+ if err := doc.SaveToFile("ofile/" + filename); err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存为PDF文件
|
|
|
+ defer func() {
|
|
|
+ os.Remove("ofile/" + filename)
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 返回生成的 Excel 文件
|
|
|
+ c.Ctx.Output.Download("ofile/" + filename)
|
|
|
+}
|
|
|
+
|
|
|
+func (c StockTemplateController) TransportRecordPdf(reqData dto.TransportRecordWordReq) {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+
|
|
|
+ list, err := s.StockTemplateTransportRecordWord(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ cols := []float64{30, 22, 20, 27, 31, 22, 21, 11, 11}
|
|
|
+
|
|
|
+ header := []string{"品种", "生产企业", "批准文号", "批签发合格编号", "规格(剂/支或粒)", "批号", "效期", "数量", "单位"}
|
|
|
+ rows := [][]string{}
|
|
|
+ for _, row := range list {
|
|
|
+ temp := []string{}
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldProductName]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldEnterpriseName]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldApprovalNumber]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldQualificationNumber]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldSpecName]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
+ temp = append(temp, fmt.Sprintf("%d", utils.ToInt(row["quantity"])))
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", row[models.FieldUnitName]))
|
|
|
+ rows = append(rows, temp)
|
|
|
+ }
|
|
|
+ if len(list) < 11 {
|
|
|
+ for i := 0; i < 11-len(list); i++ {
|
|
|
+ rows = append(rows, []string{"", "", "", "", "", "", "", "", ""})
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ pdf := gofpdf.New("P", "mm", "A4", "")
|
|
|
+
|
|
|
+ pdf.AddPage()
|
|
|
+ pdf.AddUTF8Font("simsun", "", "static/fonts/MiSans-Medium.ttf")
|
|
|
+ pdf.SetFont("simsun", "", 22)
|
|
|
+ pdf.SetMargins(2, 5, 5)
|
|
|
+ pdf.SetAutoPageBreak(true, 0)
|
|
|
+ pagew, pageh := pdf.GetPageSize()
|
|
|
+ _, _, _, mbottom := pdf.GetMargins()
|
|
|
+
|
|
|
+ titleStr := "表3-4 运输记录表"
|
|
|
+ titleWd := pdf.GetStringWidth(titleStr)
|
|
|
+ titleX := (pagew - titleWd) / 2
|
|
|
+ pdf.Text(titleX, 15, titleStr)
|
|
|
+
|
|
|
+ pdf.SetFont("simsun", "", 16)
|
|
|
+ titleStr = "(各级通用)"
|
|
|
+ titleWd = pdf.GetStringWidth(titleStr)
|
|
|
+ titleX = (pagew - titleWd) / 2
|
|
|
+ pdf.Text(titleX, 25, titleStr)
|
|
|
+
|
|
|
+ pdf.SetFont("simsun", "", 10)
|
|
|
+ curx, y := pdf.GetXY()
|
|
|
+ y = 25
|
|
|
+ y += 8
|
|
|
+ pdf.Text(curx, y, "运输工具: □冷藏车 □运输车 □普通车辆 □无 □其他")
|
|
|
+ y += 8
|
|
|
+ pdf.Text(curx, y, "冷藏工具: □冷藏车 □车载冷藏箱 □冷藏箱或冷藏包 □其他")
|
|
|
+ y += 8
|
|
|
+ pdf.Text(curx, y, "配送方式: □本级配送(车牌号:_______) □下级自运(车牌号:_______)")
|
|
|
+
|
|
|
+ y += 10
|
|
|
+ pdf.Text(curx, y, "运输情况:")
|
|
|
+ y += 3
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ h := 10.0
|
|
|
+ for i := 0; i < len(header); i++ {
|
|
|
+ pdf.CellFormat(cols[i], h, header[i], "1", 0, "CM", false, 0, "")
|
|
|
+ }
|
|
|
+ pdf.Ln(-1)
|
|
|
+ pdf.SetFont("simsun", "", 9)
|
|
|
+ marginCell := 4. // margin of top/bottom of cell
|
|
|
+ y = pdf.GetY()
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ for _, row := range rows {
|
|
|
+ curx, y = pdf.GetXY()
|
|
|
+ if y > pageh-mbottom-marginCell {
|
|
|
+ pdf.AddPage()
|
|
|
+ y = pdf.GetY()
|
|
|
+ }
|
|
|
+ x := curx
|
|
|
+
|
|
|
+ height := 0.
|
|
|
+ _, lineHt := pdf.GetFontSize()
|
|
|
+
|
|
|
+ for i, txt := range row {
|
|
|
+ lines := pdf.SplitLines([]byte(txt), cols[i])
|
|
|
+ h = float64(len(lines))*lineHt + marginCell*float64(len(lines))
|
|
|
+ if h > height {
|
|
|
+ height = h
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //// add a new page if the height of the row doesn't fit on the page
|
|
|
+ //if pdf.GetY()+height > pageh-mbottom {
|
|
|
+ // pdf.AddPage()
|
|
|
+ // y = pdf.GetY()
|
|
|
+ //}
|
|
|
+ for i, txt := range row {
|
|
|
+ width := cols[i]
|
|
|
+ if len(txt) == 0 {
|
|
|
+ height = lineHt + marginCell
|
|
|
+ }
|
|
|
+ pdf.Rect(x, y, width, height, "")
|
|
|
+ pdf.MultiCell(width, lineHt+marginCell, txt, "", "CM", false)
|
|
|
+ x += width
|
|
|
+ pdf.SetXY(x, y)
|
|
|
+ }
|
|
|
+
|
|
|
+ pdf.SetXY(curx, y+height)
|
|
|
+ }
|
|
|
+
|
|
|
+ y += 20
|
|
|
+ pdf.Text(curx, y, "运输温度记录:")
|
|
|
+ y += 3
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ header2 := []string{"", "日期/时间", "储存温度", "冰排状态", "环境温度"}
|
|
|
+ cols2 := []float64{20, 77, 34, 34, 30}
|
|
|
+ h = 10.0
|
|
|
+ for i := 0; i < len(header2); i++ {
|
|
|
+ pdf.CellFormat(cols2[i], h, header2[i], "1", 0, "CM", false, 0, "")
|
|
|
+ }
|
|
|
+ pdf.Ln(-1)
|
|
|
+ y = pdf.GetY()
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+
|
|
|
+ row2 := [][]string{
|
|
|
+ {"启运", "______年___月___日___时___分", "________℃", "", "________℃"},
|
|
|
+ {"途中", "______年___月___日___时___分", "________℃", "————", "________℃"},
|
|
|
+ {"到达", "______年___月___日___时___分", "________℃", "", "________℃"},
|
|
|
+ }
|
|
|
+
|
|
|
+ for j, row := range row2 {
|
|
|
+ curx, y = pdf.GetXY()
|
|
|
+ x := curx
|
|
|
+ _, lineHt := pdf.GetFontSize()
|
|
|
+ height := lineHt * 3
|
|
|
+ if j == 1 {
|
|
|
+ height = lineHt * 5
|
|
|
+ }
|
|
|
+
|
|
|
+ // add a new page if the height of the row doesn't fit on the page
|
|
|
+ if pdf.GetY()+height > pageh-mbottom {
|
|
|
+ pdf.AddPage()
|
|
|
+ y = pdf.GetY()
|
|
|
+ }
|
|
|
+ for i, txt := range row {
|
|
|
+ width := cols2[i]
|
|
|
+ txtWd := pdf.GetStringWidth(txt)
|
|
|
+
|
|
|
+ txtX := x + (width-txtWd)/2
|
|
|
+
|
|
|
+ if j == 1 {
|
|
|
+ if i == 1 || i == 2 || i == 4 {
|
|
|
+ txtY := y + height/5*2
|
|
|
+ pdf.Text(txtX, txtY, txt)
|
|
|
+ txtY = y + height/5*4
|
|
|
+ pdf.Text(txtX, txtY, txt)
|
|
|
+ } else {
|
|
|
+ txtY := y + height/5*3
|
|
|
+ pdf.Text(txtX, txtY, txt)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ txtY := y + height/3*2
|
|
|
+ pdf.Text(txtX, txtY, txt)
|
|
|
+ }
|
|
|
+
|
|
|
+ pdf.Rect(x, y, width, height, "")
|
|
|
+
|
|
|
+ x += width
|
|
|
+ pdf.SetXY(x, y)
|
|
|
+ }
|
|
|
+ pdf.SetXY(curx, y+height)
|
|
|
+ }
|
|
|
+ curx, y = pdf.GetXY()
|
|
|
+ y += 3
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ pdf.CellFormat(0, 10, "启运至到达行驶里程数:_________千米", "", 0, "", false, 0, "")
|
|
|
+
|
|
|
+ y = pdf.GetY()
|
|
|
+ y += 8
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ txtWd := pdf.GetStringWidth("发货单位:")
|
|
|
+ pdf.CellFormat(txtWd, 10, "发货单位:", "", 0, "", false, 0, "")
|
|
|
+ pdf.SetFont("simsun", "U", 9)
|
|
|
+ pdf.SetUnderlineThickness(2)
|
|
|
+ txtWd = pdf.GetStringWidth(beegouser.GetDeptName(c.Ctx))
|
|
|
+ pdf.CellFormat(txtWd, 10, beegouser.GetDeptName(c.Ctx), "", 0, "", false, 0, "")
|
|
|
+
|
|
|
+ pdf.SetXY(120, y)
|
|
|
+ pdf.SetFont("simsun", "", 9)
|
|
|
+ pdf.CellFormat(0, 10, "发货人签名:___________________________", "", 0, "", false, 0, "")
|
|
|
+
|
|
|
+ y = pdf.GetY()
|
|
|
+ y += 8
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ txtWd = pdf.GetStringWidth("收货单位:")
|
|
|
+ pdf.CellFormat(txtWd, 10, "收货单位:", "", 0, "", false, 0, "")
|
|
|
+ pdf.SetFont("simsun", "U", 9)
|
|
|
+ pdf.SetUnderlineThickness(2)
|
|
|
+ txtWd = pdf.GetStringWidth(reqData.ReceivingUnit)
|
|
|
+ pdf.CellFormat(txtWd, 10, reqData.ReceivingUnit, "", 0, "", false, 0, "")
|
|
|
+
|
|
|
+ pdf.SetXY(120, y)
|
|
|
+ pdf.SetFont("simsun", "", 9)
|
|
|
+ pdf.CellFormat(0, 10, "收货人签名:___________________________", "", 0, "", false, 0, "")
|
|
|
+
|
|
|
+ y = pdf.GetY()
|
|
|
+ y += 10
|
|
|
+ pdf.SetXY(curx, y)
|
|
|
+ txt := "填表说明:本表供疫苗配送企业、疾病预防控制机构、接种单位疫苗运输时填写;出入库单号为单位编码+年月日+2位流水号;运输超过6小时需记录途中温度,间隔不超过6小时;使用无自动温度显示的冰排保冷设备时,只在启运和达到时填写冰排状态(冻结、冰水混合物、完全融化)。"
|
|
|
+ pdf.MultiCell(0, 5, txt, "", "", false)
|
|
|
+ pdf.Ln(-1)
|
|
|
+
|
|
|
+ pdf.SetFooterFunc(func() {
|
|
|
+ // Position at 1.5 cm from bottom
|
|
|
+ pdf.SetY(-15)
|
|
|
+ // Arial italic 8
|
|
|
+ pdf.SetFont("simsun", "", 8)
|
|
|
+ // Text color in gray
|
|
|
+ //pdf.SetTextColor(128, 128, 128)
|
|
|
+ // Page number
|
|
|
+ pdf.CellFormat(0, 10, fmt.Sprintf("第 %d 页 / 共 %d 页", pdf.PageNo(), pdf.PageCount()),
|
|
|
+ "", 0, "C", false, 0, "")
|
|
|
+ })
|
|
|
+ filename := "运输记录表" + time.Now().Format("20060102150405") + ".pdf"
|
|
|
+ // 保存文件
|
|
|
+ if err = pdf.OutputFileAndClose("ofile/" + filename); err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ os.Remove("ofile/" + filename)
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 返回生成的 Excel 文件
|
|
|
+ c.Ctx.Output.Download("ofile/" + filename)
|
|
|
+
|
|
|
+}
|
|
|
+func (c StockTemplateController) TransportRecordExport() {
|
|
|
+ reqData := dto.TransportRecordWordReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ models.InitBasicData(deptId)
|
|
|
+
|
|
|
+ if reqData.Type == "pdf" {
|
|
|
+ c.TransportRecordPdf(reqData)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if reqData.Type == "word" {
|
|
|
+ c.TransportRecordWord(reqData)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// StockUnitList 获取收货单位,发货单位,收发单位
|
|
|
+// @Summary 获取收货单位,发货单位,收发单位
|
|
|
+// @Description 获取收货单位,发货单位,收发单位
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockUnitListReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock/unit/list [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockUnitList() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockUnitListReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, err := s.StockUnitList(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, 0, 0, 0, "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockOperatorList 获取收货单位,发货单位,收发单位
|
|
|
+// @Summary 获取收货单位,发货单位,收发单位
|
|
|
+// @Description 获取收货单位,发货单位,收发单位
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockOperatorListReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock/unit/list [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockOperatorList() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockOperatorListReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, err := s.StockOperatorList(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, 0, 0, 0, "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockStatList 库存查询
|
|
|
+// @Summary 库存查询-每个商品、生产企业、规格、批号数量
|
|
|
+// @Description 库存查询
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockStatListReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock/stat [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockInquiryList() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockStatListReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, cnt, err := s.StockInquiryList(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, int(cnt), reqData.GetPageIndex(), reqData.GetPageSize(), "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockInquiryExcel 导出库存信息表
|
|
|
+// @Summary 库存信息表-每个商品、生产企业、规格、批号数量
|
|
|
+// @Description 库存信息表
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockStatListReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock/stat/excel [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockInquiryExcel() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockStatListReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, err := s.StockInquiryExcel(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ f := excelize.NewFile() // 设置单元格的值
|
|
|
+ StyleTitle, _ := f.NewStyle(
|
|
|
+ &excelize.Style{
|
|
|
+ Font: &excelize.Font{Bold: true, Size: 20, Family: "宋体"},
|
|
|
+ Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
|
|
|
+ })
|
|
|
+ f.MergeCell("Sheet1", "A1", "L1")
|
|
|
+ f.SetRowStyle("Sheet1", 1, 1, StyleTitle)
|
|
|
+ f.SetRowHeight("Sheet1", 1, 50)
|
|
|
+ f.SetCellValue("Sheet1", "A1", fmt.Sprintf("疫苗库存信息表(%s)", time.Now().Format("2006-01-02 15:04:05")))
|
|
|
+ // 这里设置表头
|
|
|
+ f.SetCellValue("Sheet1", "A2", "品名")
|
|
|
+ f.SetCellValue("Sheet1", "B2", "生产企业")
|
|
|
+ f.SetCellValue("Sheet1", "C2", "规格")
|
|
|
+ f.SetCellValue("Sheet1", "D2", "剂型")
|
|
|
+ f.SetCellValue("Sheet1", "E2", "单位")
|
|
|
+ f.SetCellValue("Sheet1", "F2", "数量")
|
|
|
+ f.SetCellValue("Sheet1", "G2", "购进单价")
|
|
|
+ f.SetCellValue("Sheet1", "H2", "销售单价")
|
|
|
+ f.SetCellValue("Sheet1", "I2", "批号")
|
|
|
+ f.SetCellValue("Sheet1", "J2", "效期")
|
|
|
+ f.SetCellValue("Sheet1", "K2", "批准文号")
|
|
|
+ f.SetCellValue("Sheet1", "L2", "批签发编号")
|
|
|
+ // 设置列宽
|
|
|
+ f.SetColWidth("Sheet1", "A", "A", 20)
|
|
|
+ f.SetColWidth("Sheet1", "B", "C", 15)
|
|
|
+ f.SetColWidth("Sheet1", "D", "F", 12)
|
|
|
+ f.SetColWidth("Sheet1", "F", "G", 10)
|
|
|
+ f.SetColWidth("Sheet1", "G", "I", 10)
|
|
|
+ f.SetColWidth("Sheet1", "I", "J", 12)
|
|
|
+ f.SetColWidth("Sheet1", "J", "L", 15)
|
|
|
+
|
|
|
+ line := 2
|
|
|
+
|
|
|
+ // 循环写入数据
|
|
|
+ for _, v := range list {
|
|
|
+ line++
|
|
|
+
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("A%d", line), v[models.FieldProductName])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), v[models.FieldEnterpriseName])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("C%d", line), v[models.FieldSpecName])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("D%d", line), v[models.FieldDosageFormName])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("E%d", line), v[models.FieldUnitName])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), v["balance"])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), utils.ToFloat64(v["purchase_unit_price"]))
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("H%d", line), utils.ToFloat64(v["sales_unit_price"]))
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), v["batch_number"])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("J%d", line), v[models.FieldExpiryDate])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("K%d", line), v["approval_number"])
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("L%d", line), v["qualification_number"])
|
|
|
+
|
|
|
+ }
|
|
|
+ Style1, _ := f.NewStyle(
|
|
|
+ &excelize.Style{
|
|
|
+ Font: &excelize.Font{Size: 12, Family: "宋体", Bold: true},
|
|
|
+ Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center", WrapText: true},
|
|
|
+ Border: []excelize.Border{
|
|
|
+ {Type: "left", Color: "000000", Style: 1},
|
|
|
+ {Type: "top", Color: "000000", Style: 1},
|
|
|
+ {Type: "bottom", Color: "000000", Style: 1},
|
|
|
+ {Type: "right", Color: "000000", Style: 1},
|
|
|
+ },
|
|
|
+ })
|
|
|
+ f.SetCellStyle("Sheet1", "A2", "L2", Style1)
|
|
|
+ Style2, _ := f.NewStyle(
|
|
|
+ &excelize.Style{
|
|
|
+ Font: &excelize.Font{Size: 12, Family: "宋体"},
|
|
|
+ Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center", WrapText: true},
|
|
|
+ Border: []excelize.Border{
|
|
|
+ {Type: "left", Color: "000000", Style: 1},
|
|
|
+ {Type: "top", Color: "000000", Style: 1},
|
|
|
+ {Type: "bottom", Color: "000000", Style: 1},
|
|
|
+ {Type: "right", Color: "000000", Style: 1},
|
|
|
+ },
|
|
|
+ })
|
|
|
+ f.SetCellStyle("Sheet1", "A3", fmt.Sprintf("L%d", line), Style2)
|
|
|
+
|
|
|
+ filename := "库存信息表" + time.Now().Format("20060102150405") + ".xlsx"
|
|
|
+ // 保存文件
|
|
|
+ if err := f.SaveAs("ofile/" + filename); err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ os.Remove("ofile/" + filename)
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 返回生成的 Excel 文件
|
|
|
+ c.Ctx.Output.Download("ofile/" + filename)
|
|
|
+}
|
|
|
+
|
|
|
+// StockStat 库存统计
|
|
|
+// @Summary 库存查询-每个商品数量(不区别生产企业)
|
|
|
+// @Description 库存查询
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockStatListReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock/stat [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockStat() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+ reqData := dto.StockStatReq{}
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, cnt, err := s.StockStat(&reqData, deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, int(cnt), 0, 0, "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// StockHomeStat 首页出入库信息统计
|
|
|
+// @Summary 首页出入库信息统计
|
|
|
+// @Description 首页出入库信息统计
|
|
|
+// @Tags 库存
|
|
|
+// @Param body body dto.StockStatListReq true "body"
|
|
|
+// @Success 200 {object} response.Page "{"code": 200, "data": [...]}"
|
|
|
+// @Router /stock/stat [post]
|
|
|
+// @Security Bearer
|
|
|
+func (c StockTemplateController) StockHomeStat() {
|
|
|
+ s := services.StockTemplate{}
|
|
|
+
|
|
|
+ deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ list, cnt, err := s.StockHomeStat(deptId)
|
|
|
+ if err != nil {
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.PageOK(list, int(cnt), 0, 0, "查询成功")
|
|
|
+}
|
|
|
+
|
|
|
+// 列表 - 接口
|
|
|
+func (c *StockTemplateController) InventoryPdf() {
|
|
|
+ //s := services.StockTemplate{}
|
|
|
+ //reqData := dto.StockTemplateInventoryPageReq{}
|
|
|
+ //if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
+ // c.Error(global.ParseFormErr, err, err.Error())
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //deptId := beegouser.GetDeptId(c.Ctx)
|
|
|
+ //list, _, err := s.StockTemplateInventoryList(&reqData, deptId)
|
|
|
+ //if err != nil {
|
|
|
+ // c.Error(500, err, err.Error())
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ pdf := gopdf.GoPdf{}
|
|
|
+ pdf.Start(gopdf.Config{PageSize: gopdf.Rect{W: 841.89, H: 595.28}})
|
|
|
+
|
|
|
+ // 添加页面
|
|
|
+ pdf.AddPage()
|
|
|
+
|
|
|
+ // 设置字体
|
|
|
+ pdf.AddTTFFont("simsun", "static/fonts/MiSans-Medium.ttf")
|
|
|
+ pdf.SetFont("simsun", "", 20)
|
|
|
+ textw, _ := pdf.MeasureTextWidth("生物制品收发登记")
|
|
|
+ pdf.SetX((841 / 2) - (textw / 2))
|
|
|
+ pdf.SetY(40)
|
|
|
+ pdf.Text("生物制品收发登记")
|
|
|
+ // 添加文本内容
|
|
|
+ pdf.SetFont("simsun", "", 12)
|
|
|
+ pdf.SetX(500)
|
|
|
+ pdf.SetY(70)
|
|
|
+ pdf.Text("制品名称:脊灰疫苗")
|
|
|
+ pdf.SetX(500)
|
|
|
+ pdf.SetY(90)
|
|
|
+ pdf.Text("剂型: 规格:1g/粒/剂 单位:")
|
|
|
+
|
|
|
+ pdf.AddPage()
|
|
|
+ textw, _ = pdf.MeasureTextWidth("生物制品收发登记2")
|
|
|
+ pdf.SetFont("simsun", "", 20)
|
|
|
+
|
|
|
+ pdf.SetX((841 / 2) - (textw / 2))
|
|
|
+ pdf.SetY(40)
|
|
|
+ pdf.Text("生物制品收发登记2")
|
|
|
+ // 添加文本内容
|
|
|
+ pdf.SetFont("simsun", "", 12)
|
|
|
+ pdf.SetX(500)
|
|
|
+ pdf.SetY(70)
|
|
|
+ pdf.Text("制品名称:脊灰疫苗")
|
|
|
+ pdf.SetX(500)
|
|
|
+ pdf.SetY(90)
|
|
|
+ pdf.Text("剂型: 规格:1g/粒/剂 单位:")
|
|
|
+ // 保存 PDF 文件
|
|
|
+ pdf.WritePdf("生物制品收发登记.pdf")
|
|
|
+
|
|
|
+ // 返回生成的 PDF 文件
|
|
|
+ c.Ctx.Output.Download("生物制品收发登记.pdf")
|
|
|
+
|
|
|
+ //var err error
|
|
|
+ //pdf := &gopdf.GoPdf{}
|
|
|
+ //
|
|
|
+ //pdf.Start(gopdf.Config{PageSize: gopdf.Rect{W: 841.89, H: 595.28}}) //595.28, 841.89 = A4
|
|
|
+ //
|
|
|
+ //err = pdf.AddTTFFont("simsun", "static/fonts/三极行楷简体-粗.ttf")
|
|
|
+ //if err != nil {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //err = pdf.SetFont("simsun", "", 24)
|
|
|
+ //if err != nil {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //pdf.SetGrayFill(0.5)
|
|
|
+ //
|
|
|
+ //pdf.SetMargins(0, 20, 0, 20)
|
|
|
+ //pdf.AddPage()
|
|
|
+ //
|
|
|
+ //company, _ := Account.Read_Company_ById(c.T_pid)
|
|
|
+ //
|
|
|
+ //textw, _ := pdf.MeasureTextWidth(company.T_name)
|
|
|
+ //pdf.SetX((595 / 2) - (textw / 2))
|
|
|
+ //pdf.SetY(40)
|
|
|
+ //pdf.Text(company.T_name)
|
|
|
+ //
|
|
|
+ //// 线
|
|
|
+ //pdf.SetLineWidth(2)
|
|
|
+ //pdf.SetLineType("dashed")
|
|
|
+ //pdf.Line(10, 60, 585, 60)
|
|
|
+ //
|
|
|
+ //err = pdf.AddTTFFont("wts", "static/fonts/MiSans-Medium.ttf")
|
|
|
+ //if err != nil {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //err = pdf.SetFont("wts", "", 12)
|
|
|
+ //if err != nil {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //var s_time, e_time string
|
|
|
+ //if len(DeviceSensor_data) > 0 {
|
|
|
+ // s_time = fmt.Sprintf("%s", DeviceSensor_data[0].T_time)
|
|
|
+ // e_time = fmt.Sprintf("%s", DeviceSensor_data[len(DeviceSensor_data)-1].T_time)
|
|
|
+ //}
|
|
|
+ ////fmt.Sprintf(" %.1f ", v.T_t)
|
|
|
+ //lib.RectFillColor(pdf, "历史数据["+e_time+" / "+s_time+"]", 14, 22, 80, 550, 40, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //
|
|
|
+ //lib.RectFillColor(pdf, "序号", 12, 22, 120, 30, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //lib.RectFillColor(pdf, "传感器名称", 12, 52, 120, 100, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //lib.RectFillColor(pdf, "温度℃", 12, 152, 120, 50, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //
|
|
|
+ //lib.RectFillColor(pdf, "湿度%", 12, 202, 120, 50, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //
|
|
|
+ //lib.RectFillColor(pdf, "温度范围", 12, 252, 120, 80, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //lib.RectFillColor(pdf, "湿度范围", 12, 332, 120, 80, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //lib.RectFillColor(pdf, "记录时间", 12, 412, 120, 120, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //lib.RectFillColor(pdf, "备注", 12, 532, 120, 40, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //
|
|
|
+ //var y float64 = 140
|
|
|
+ //
|
|
|
+ //err = pdf.SetFont("wts", "", 10)
|
|
|
+ //if err != nil {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //for i, v := range DeviceSensor_data {
|
|
|
+ // text := fmt.Sprintf(" %d ", i+1)
|
|
|
+ // var textH float64 = 25 // if text height is 25px.
|
|
|
+ // pdf.SetNewY(y, textH)
|
|
|
+ // y = pdf.GetY()
|
|
|
+ // //pdf.SetX(x) // must after pdf.SetNewY() called.
|
|
|
+ // //err = pdf.Text(text)
|
|
|
+ // //if err != nil {
|
|
|
+ // // log.Fatalln(err)
|
|
|
+ // //}
|
|
|
+ //
|
|
|
+ // T_t := fmt.Sprintf(" %.1f ", v.T_t)
|
|
|
+ // T_rh := fmt.Sprintf(" %.1f ", v.T_rh)
|
|
|
+ // T_Tlu := fmt.Sprintf(" %.1f ~ %.1f ", v.T_tl, v.T_tu)
|
|
|
+ // T_Rlu := fmt.Sprintf(" %.1f ~ %.1f ", v.T_rhl, v.T_rhu)
|
|
|
+ // T_time := fmt.Sprintf("%s", v.T_time)
|
|
|
+ //
|
|
|
+ // if v.T_ist == 1 {
|
|
|
+ // lib.RectFillColor(pdf, T_t, 10, 152, y, 50, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // lib.RectFillColor(pdf, T_Tlu, 10, 252, y, 80, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // } else {
|
|
|
+ // lib.RectFillColor(pdf, "", 10, 152, y, 50, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // lib.RectFillColor(pdf, "", 10, 252, y, 80, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // }
|
|
|
+ // if v.T_ish == 1 {
|
|
|
+ // lib.RectFillColor(pdf, T_rh, 10, 202, y, 50, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // lib.RectFillColor(pdf, T_Rlu, 10, 332, y, 80, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // } else {
|
|
|
+ // lib.RectFillColor(pdf, "", 10, 202, y, 50, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // lib.RectFillColor(pdf, "", 10, 332, y, 80, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // lib.RectFillColor(pdf, text, 10, 22, y, 30, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // lib.RectFillColor(pdf, v.T_name, 10, 52, y, 100, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ //
|
|
|
+ // lib.RectFillColor(pdf, T_time, 10, 412, y, 120, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // lib.RectFillColor(pdf, v.T_remark, 10, 532, y, 40, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
|
|
|
+ // y += 20
|
|
|
+ //}
|
|
|
+ //timeStr := "ofile/" + time.Now().Format("20060102150405") + ".pdf"
|
|
|
+ //
|
|
|
+ //err = pdf.WritePdf(timeStr)
|
|
|
+ //if err != nil {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //// 上传 OSS
|
|
|
+ //url, is := NatsServer.Qiniu_UploadFile(lib.GetCurrentDirectory()+"/"+timeStr, timeStr)
|
|
|
+ //if !is {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 202, Msg: "oss!"}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ ////删除目录
|
|
|
+ //err = os.Remove(timeStr)
|
|
|
+ //if err != nil {
|
|
|
+ // fmt.Println(err)
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: url}
|
|
|
+ //c.ServeJSON()
|
|
|
+ //return
|
|
|
+
|
|
|
+}
|